public class Config extends Object
The top level class for configuring the whole application. This class includes the configuration for the input file, the output file(s) and the random number generation and presentation.
To create a new instance programmatically use the Builder
which can be obtained by the method builder()
.
This class is immutable.
Modifier and Type | Class and Description |
---|---|
static class |
Config.Builder
This class is a Builder to build a
Config programmatically. |
Constructor and Description |
---|
Config(FileConfig input,
OutputConfig output,
GenerationConfig random,
GenerationConfig predefined)
Create a new
Config with the given part configurations. |
Modifier and Type | Method and Description |
---|---|
static Config.Builder |
builder()
Return a
Builder that can be used to build a config. |
FileConfig |
getInput()
Return the input file configuration.
|
OutputConfig |
getOutput()
Return the output file(s) configuration.
|
GenerationConfig |
getPredefined()
Return the predefined presentation configuration.
|
GenerationConfig |
getRandom()
Return the random generation and presentation configuration.
|
static Config |
readYamlConfig(File configFile)
A factory method to create a configuration from a YAML file.
|
public Config(FileConfig input, OutputConfig output, GenerationConfig random, GenerationConfig predefined)
Create a new Config
with the given part configurations.
This constructor is annotated so that a YAML or JSON parsed with jackson fasterxml can create an instance directly.
input
- the input file configuration.output
- the output file(s) configuration.random
- the random generation and presentation configuration.predefined
- the predefined presentation configuration.IllegalArgumentException
- if either input
, output
or random
is null
.public FileConfig getInput()
Return the input file configuration.
public OutputConfig getOutput()
Return the output file(s) configuration.
public GenerationConfig getRandom()
Return the random generation and presentation configuration.
public GenerationConfig getPredefined()
Return the predefined presentation configuration.
public static Config readYamlConfig(File configFile) throws IOException
A factory method to create a configuration from a YAML file.
configFile
- the YAML file to read.IOException
- if the reading of the file fails.public static Config.Builder builder()
Return a Builder
that can be used to build a config.
Builder
.Copyright © 2020 sw4j.org. All rights reserved.