Package de.poiu.coat.example
Class ImmutableAppConfig
java.lang.Object
de.poiu.coat.CoatConfig
de.poiu.coat.example.ImmutableAppConfig
- All Implemented Interfaces:
AppConfig
@Generated(value="de.poiu.coat.processor.codegeneration.CodeGenerator",
date="2024-02-28T22:55:19.936645452+01:00")
public class ImmutableAppConfig
extends CoatConfig
implements AppConfig
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for creating newImmutableAppConfiginstances. -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableAppConfig.Builderbuilder()Create a builder forImmutableAppConfiginstances.booleanstatic ImmutableAppConfigCreate a new ImmutableAppConfig from the given config file.static ImmutableAppConfigCreate a new ImmutableAppConfig from the given config entries.static ImmutableAppConfigfrom(Properties jup) Create a new ImmutableAppConfig from the given config entries.static ImmutableAppConfigCreate a new ImmutableAppConfig from the current environment variables.A short description of the purpose of this application.The interfaces to listen on for incoming connections.intThe port to listen on for incoming connections.getName()A shorthand name for this application.inthashCode()mqtt()The configuration for the MQTT connectionstatic voidwriteExampleConfig(Writer writer) Write an example config file to the given Writer.Methods inherited from class de.poiu.coat.CoatConfig
add, filterByAndStripPrefix, get, get, getArray, getArrayOrDefault, getBoolean, getBooleanOrDefault, getDouble, getDoubleOrDefault, getInt, getIntOrDefault, getList, getListOrDefault, getLong, getLongOrDefault, getOptional, getOptionalDouble, getOptionalDoubleOrDefault, getOptionalInt, getOptionalIntOrDefault, getOptionalLong, getOptionalLongOrDefault, getOptionalOrDefault, getOptionalString, getOrDefault, getSet, getSetOrDefault, getString, getStringOrDefault, hasPrefix, registerConverter, registerCustomConverter, registerEmbeddedConfig, registerListParser, toMap, toMap, toString, validate
-
Method Details
-
from
Create a new ImmutableAppConfig from the given config entries.- Parameters:
props- the config entries- Returns:
- the ImmutableAppConfig created with the given entries
-
from
Create a new ImmutableAppConfig from the given config file.- Parameters:
file- the config file to read- Returns:
- the ImmutableAppConfig created with the entries from the given file
- Throws:
IOException- if reading the given file failed
-
from
Create a new ImmutableAppConfig from the given config entries.- Parameters:
jup- the config entries- Returns:
- the ImmutableAppConfig created with the given entries
-
fromEnvVars
Create a new ImmutableAppConfig from the current environment variables.Since the allowed characters for environment variables are much more restricted than Coat config keys, a relaxed mapping is applied.
Dots and hyphens are treated as underscores. Also uppercase characters in config keys are preceded by an underscore (to convert camelCase to UPPER_CASE). Comparison between the environment variables and the config keys is done case insensitively.
For example the environment variable
SERVER_MQTT_HOSTwill match the config keyserver.mqttHost.- Returns:
- the ImmutableAppConfig created with the entries in the current environment variables
-
getName
A shorthand name for this application. -
getDescription
A short description of the purpose of this application.- Specified by:
getDescriptionin interfaceAppConfig
-
getListenAddress
The interfaces to listen on for incoming connections.- Specified by:
getListenAddressin interfaceAppConfig
-
getListenPort
public int getListenPort()The port to listen on for incoming connections.- Specified by:
getListenPortin interfaceAppConfig
-
mqtt
The configuration for the MQTT connection -
equals
-
hashCode
public int hashCode() -
writeExampleConfig
Write an example config file to the given Writer.- Parameters:
writer- the Writer to write to- Throws:
IOException- if writing the example config file fails
-
builder
Create a builder forImmutableAppConfiginstances.Call the
addand/oraddEnvVarsmethods for specifying the config sources (and the order in which they are applied), then callImmutableAppConfig.Builder.build()to create the ImmutableAppConfig- Returns:
- an new ImmutableAppConfig builder
-