Class AzkarraConf
- java.lang.Object
-
- io.streamthoughts.azkarra.api.config.AbstractConf
-
- io.streamthoughts.azkarra.streams.config.AzkarraConf
-
- All Implemented Interfaces:
Conf
public class AzkarraConf extends AbstractConf
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AzkarraConf(com.typesafe.config.Config config)
Creates a newAzkarraConf
instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AzkarraConf
create()
Static helper that can be used to creates a newAzkarraConf
instance using the specified resource base name.static AzkarraConf
create(String resourceBasename)
Static helper that can be used to creates a newAzkarraConf
instance using the specified resource base name.static AzkarraConf
create(Map<String,? extends Object> config)
Static helper that can be used to creates a newAzkarraConf
instance from the specified map.static AzkarraConf
create(Properties config)
Static helper that can be used to creates a newAzkarraConf
instance from the specified properties.static AzkarraConf
empty()
Static helper that can be used to creates a new emptyAzkarraConf
instance.boolean
getBoolean(String key)
Gets a required parameter as an boolean.Map<String,Object>
getConfAsMap()
Converts thisConf
into a path-value map.Properties
getConfAsProperties()
Converts thisConf
into a properties.double
getDouble(String key)
Gets a required parameter as a double.int
getInt(String key)
Gets a required parameter as an integer.long
getLong(String key)
Gets a required parameter as a long.String
getString(String path)
Gets a required parameter a a string.List<String>
getStringList(String key)
Gets a required parameter as a list.Conf
getSubConf(String key)
Gets a required parameter as aConf
.List<Conf>
getSubConfList(String key)
Gets a required parameter as a list ofConf
.boolean
hasPath(String key)
Checks whether the specified path exists into thisConf
.Conf
withFallback(Conf defaults)
-
Methods inherited from class io.streamthoughts.azkarra.api.config.AbstractConf
getClass, getClasses
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.streamthoughts.azkarra.api.config.Conf
getOptionalBoolean, getOptionalDouble, getOptionalInt, getOptionalLong, getOptionalString
-
-
-
-
Constructor Detail
-
AzkarraConf
protected AzkarraConf(com.typesafe.config.Config config)
Creates a newAzkarraConf
instance.- Parameters:
config
- theConfig
instance to used as default configuration.
-
-
Method Detail
-
empty
public static AzkarraConf empty()
Static helper that can be used to creates a new emptyAzkarraConf
instance.- Returns:
- a new
AzkarraConf
instance.
-
create
public static AzkarraConf create(Properties config)
Static helper that can be used to creates a newAzkarraConf
instance from the specified properties.- Returns:
- a new
AzkarraConf
instance.
-
create
public static AzkarraConf create(Map<String,? extends Object> config)
Static helper that can be used to creates a newAzkarraConf
instance from the specified map.- Returns:
- a new
AzkarraConf
instance.
-
create
public static AzkarraConf create(String resourceBasename)
Static helper that can be used to creates a newAzkarraConf
instance using the specified resource base name.- Returns:
- a new
AzkarraConf
instance.
-
create
public static AzkarraConf create()
Static helper that can be used to creates a newAzkarraConf
instance using the specified resource base name.This method loads the following (first-listed are higher priority):
- system properties
- application.conf (all resources on classpath with this name)
- application.json (all resources on classpath with this name)
- application.properties (all resources on classpath with this name)
- reference.conf (all resources on classpath with this name)
- Returns:
- a new
AzkarraConf
instance.
-
getString
public String getString(String path)
Gets a required parameter a a string.- Parameters:
path
- the parameter path.- Returns:
- the parameter value as a string.
-
getLong
public long getLong(String key)
Gets a required parameter as a long.- Parameters:
key
- the parameter path.- Returns:
- the parameter value as a long.
-
getInt
public int getInt(String key)
Gets a required parameter as an integer.- Parameters:
key
- the parameter path.- Returns:
- the parameter value as a int.
-
getBoolean
public boolean getBoolean(String key)
Gets a required parameter as an boolean.- Parameters:
key
- the parameter path.- Returns:
- the parameter value as a boolean.
-
getDouble
public double getDouble(String key)
Gets a required parameter as a double.- Parameters:
key
- the parameter path.- Returns:
- the parameter value as a double.
-
getStringList
public List<String> getStringList(String key)
Gets a required parameter as a list.- Parameters:
key
- the parameter path.- Returns:
- a string list value.
-
getSubConf
public Conf getSubConf(String key)
Gets a required parameter as aConf
.- Parameters:
key
- the parameter path.- Returns:
- a new
Conf
instance.
-
getSubConfList
public List<Conf> getSubConfList(String key)
Gets a required parameter as a list ofConf
.- Parameters:
key
- the parameter path.- Returns:
- a new list of
Conf
instances.
-
hasPath
public boolean hasPath(String key)
Checks whether the specified path exists into thisConf
.- Parameters:
key
- the path to be checked.- Returns:
true
if the path exists,false
otherwise.
-
getConfAsMap
public Map<String,Object> getConfAsMap()
Converts thisConf
into a path-value map.- Returns:
- a new
Map
instance containing the configuration values.
-
getConfAsProperties
public Properties getConfAsProperties()
Converts thisConf
into a properties.- Returns:
- a new
Properties
instance containing the configuration values.
-
-