Class ConfBuilder
- java.lang.Object
-
- io.streamthoughts.azkarra.api.config.ConfBuilder
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Conf
build()
boolean
getBoolean(String path)
Gets a required parameter as an boolean.<T> T
getClass(String path, Class<T> type)
Gets a required parameter as an instances of typeConf
.<T> Collection<T>
getClasses(String path, Class<T> type)
Gets a required parameter as a list of instances of typeConf
.Map<String,Object>
getConfAsMap()
Converts thisConf
into a path-value map.Properties
getConfAsProperties()
Converts thisConf
into a properties.double
getDouble(String path)
Gets a required parameter as a double.int
getInt(String path)
Gets a required parameter as an integer.long
getLong(String path)
Gets a required parameter as a long.String
getString(String path)
Gets a required parameter a a string.List<String>
getStringList(String path)
Gets a required parameter as a list.Conf
getSubConf(String path)
Gets a required parameter as aConf
.List<Conf>
getSubConfList(String path)
Gets a required parameter as a list ofConf
.boolean
hasPath(String path)
Checks whether the specified path exists into thisConf
.static ConfBuilder
newConf()
static ConfBuilder
newConf(Conf conf)
String
toString()
ConfBuilder
with(String key, Object value)
Conf
withFallback(Conf fallback)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.streamthoughts.azkarra.api.config.Conf
getOptionalBoolean, getOptionalDouble, getOptionalInt, getOptionalLong, getOptionalString
-
-
-
-
Method Detail
-
newConf
public static ConfBuilder newConf(Conf conf)
-
newConf
public static ConfBuilder newConf()
-
with
public ConfBuilder with(String key, Object value)
-
getLong
public long getLong(String path)
Gets a required parameter as a long.
-
getInt
public int getInt(String path)
Gets a required parameter as an integer.
-
getBoolean
public boolean getBoolean(String path)
Gets a required parameter as an boolean.- Specified by:
getBoolean
in interfaceConf
- Parameters:
path
- the parameter path.- Returns:
- the parameter value as a boolean.
-
getDouble
public double getDouble(String path)
Gets a required parameter as a double.
-
getStringList
public List<String> getStringList(String path)
Description copied from interface:Conf
Gets a required parameter as a list.- Specified by:
getStringList
in interfaceConf
- Parameters:
path
- the parameter path.- Returns:
- a string list value.
-
getSubConf
public Conf getSubConf(String path)
Gets a required parameter as aConf
.- Specified by:
getSubConf
in interfaceConf
- Parameters:
path
- the parameter path.- Returns:
- a new
Conf
instance.
-
getSubConfList
public List<Conf> getSubConfList(String path)
Gets a required parameter as a list ofConf
.- Specified by:
getSubConfList
in interfaceConf
- Parameters:
path
- the parameter path.- Returns:
- a new list of
Conf
instances.
-
hasPath
public boolean hasPath(String path)
Checks whether the specified path exists into thisConf
.
-
withFallback
public Conf withFallback(Conf fallback)
- Specified by:
withFallback
in interfaceConf
-
getClasses
public <T> Collection<T> getClasses(String path, Class<T> type)
Gets a required parameter as a list of instances of typeConf
.- Specified by:
getClasses
in interfaceConf
- Type Parameters:
T
- the expected type.- Parameters:
path
- the parameter path.type
- the class of the .- Returns:
- a new
Collection
ofConf
.
-
getClass
public <T> T getClass(String path, Class<T> type)
Gets a required parameter as an instances of typeConf
.- Specified by:
getClass
in interfaceConf
- Type Parameters:
T
- the expected type.- Parameters:
path
- the parameter path.type
- the class of the .- Returns:
- a new
Collection
ofConf
.
-
getConfAsMap
public Map<String,Object> getConfAsMap()
Converts thisConf
into a path-value map.- Specified by:
getConfAsMap
in interfaceConf
- Returns:
- a new
Map
instance containing the configuration values.
-
getConfAsProperties
public Properties getConfAsProperties()
Converts thisConf
into a properties.- Specified by:
getConfAsProperties
in interfaceConf
- Returns:
- a new
Properties
instance containing the configuration values.
-
build
public Conf build()
-
-