Package de.poiu.coat.example
Class ImmutableMqttConfig
java.lang.Object
de.poiu.coat.CoatConfig
de.poiu.coat.example.ImmutableMqttConfig
- All Implemented Interfaces:
MqttConfig
@Generated(value="de.poiu.coat.processor.codegeneration.CodeGenerator",
date="2024-03-07T23:24:03.188890378+01:00")
public class ImmutableMqttConfig
extends CoatConfig
implements MqttConfig
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for creating newImmutableMqttConfiginstances. -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableMqttConfig.Builderbuilder()Create a builder forImmutableMqttConfiginstances.booleanstatic ImmutableMqttConfigCreate a new ImmutableMqttConfig from the given config file.static ImmutableMqttConfigCreate a new ImmutableMqttConfig from the given config entries.static ImmutableMqttConfigfrom(Properties jup) Create a new ImmutableMqttConfig from the given config entries.static ImmutableMqttConfigCreate a new ImmutableMqttConfig from the current environment variables.The address(es) of the MQTT broker.The clientId to send to the MQTT broker.intgetPort()The port to communicate with the MQTT broker.inthashCode()password()The password to connect to the MQTT broker.username()The username to connect to the MQTT broker.static 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 ImmutableMqttConfig from the given config entries.- Parameters:
props- the config entries- Returns:
- the ImmutableMqttConfig created with the given entries
-
from
Create a new ImmutableMqttConfig from the given config file.- Parameters:
file- the config file to read- Returns:
- the ImmutableMqttConfig created with the entries from the given file
- Throws:
IOException- if reading the given file failed
-
from
Create a new ImmutableMqttConfig from the given config entries.- Parameters:
jup- the config entries- Returns:
- the ImmutableMqttConfig created with the given entries
-
fromEnvVars
Create a new ImmutableMqttConfig 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 ImmutableMqttConfig created with the entries in the current environment variables
-
getClientId
The clientId to send to the MQTT broker.- Specified by:
getClientIdin interfaceMqttConfig
-
getBrokerAddresses
The address(es) of the MQTT broker.- Specified by:
getBrokerAddressesin interfaceMqttConfig
-
getPort
public int getPort()The port to communicate with the MQTT broker.- Specified by:
getPortin interfaceMqttConfig
-
username
The username to connect to the MQTT broker.- Specified by:
usernamein interfaceMqttConfig
-
password
The password to connect to the MQTT broker.- Specified by:
passwordin interfaceMqttConfig
-
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 forImmutableMqttConfiginstances.Call the
addand/oraddEnvVarsmethods for specifying the config sources (and the order in which they are applied), then callImmutableMqttConfig.Builder.build()to create the ImmutableMqttConfig- Returns:
- an new ImmutableMqttConfig builder
-