Interface Conf
-
- All Known Implementing Classes:
AbstractConf
,ArgsConf
,AzkarraConf
,ConfBuilder
,EmptyConf
,MapConf
,Property
public interface Conf
Class which can be used for configuring components.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static Conf
empty()
Static helper that can be used to creates a new emptyConf
instance.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.default Optional<Boolean>
getOptionalBoolean(String path)
Gets an optional parameter as an boolean.default Optional<Double>
getOptionalDouble(String path)
Gets an optional parameter as an double.default Optional<Integer>
getOptionalInt(String path)
Gets an optional parameter as an integer.default Optional<Long>
getOptionalLong(String path)
Gets an optional parameter as a long.default Optional<String>
getOptionalString(String path)
Gets an optional parameter as a string.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 Conf
with(String path, Object value)
Static helper that can be used to creates a new emptyConf
instance using the specified key-value pair.static Conf
with(Map<String,?> map)
Conf
withFallback(Conf fallback)
-
-
-
Field Detail
-
EMPTY
static final EmptyConf EMPTY
-
-
Method Detail
-
with
static Conf with(String path, Object value)
Static helper that can be used to creates a new emptyConf
instance using the specified key-value pair.- Returns:
- a new
Conf
instance.
-
empty
static Conf empty()
Static helper that can be used to creates a new emptyConf
instance.- Returns:
- a new
Conf
instance.
-
getString
String getString(String path)
Gets a required parameter a a string.- Parameters:
path
- the parameter path.- Returns:
- the parameter value as a string.
- Throws:
MissingConfException
- if no parameter can be found for the specified path.
-
getOptionalString
default Optional<String> getOptionalString(String path)
Gets an optional parameter as a string.- Parameters:
path
- the parameter path.- Returns:
- the
Optional
value.
-
getLong
long getLong(String path)
Gets a required parameter as a long.- Parameters:
path
- the parameter path.- Returns:
- the parameter value as a long.
- Throws:
MissingConfException
- if no parameter can be found for the specified path.
-
getOptionalLong
default Optional<Long> getOptionalLong(String path)
Gets an optional parameter as a long.- Parameters:
path
- the parameter path.- Returns:
- the
Optional
value.
-
getInt
int getInt(String path)
Gets a required parameter as an integer.- Parameters:
path
- the parameter path.- Returns:
- the parameter value as a int.
- Throws:
MissingConfException
- if no parameter can be found for the specified path.
-
getOptionalInt
default Optional<Integer> getOptionalInt(String path)
Gets an optional parameter as an integer.- Parameters:
path
- the parameter path.- Returns:
- the
Optional
value.
-
getBoolean
boolean getBoolean(String path)
Gets a required parameter as an boolean.- Parameters:
path
- the parameter path.- Returns:
- the parameter value as a boolean.
- Throws:
MissingConfException
- if no parameter can be found for the specified path.
-
getOptionalBoolean
default Optional<Boolean> getOptionalBoolean(String path)
Gets an optional parameter as an boolean.- Parameters:
path
- the parameter path.- Returns:
- the
Optional
value.
-
getDouble
double getDouble(String path)
Gets a required parameter as a double.- Parameters:
path
- the parameter path.- Returns:
- the parameter value as a double.
- Throws:
MissingConfException
- if no parameter can be found for the specified path.
-
getOptionalDouble
default Optional<Double> getOptionalDouble(String path)
Gets an optional parameter as an double.- Parameters:
path
- the parameter path.- Returns:
- the
Optional
value.
-
getStringList
List<String> getStringList(String path)
Gets a required parameter as a list.- Parameters:
path
- the parameter path.- Returns:
- a string list value.
-
getSubConf
Conf getSubConf(String path)
Gets a required parameter as aConf
.- Parameters:
path
- the parameter path.- Returns:
- a new
Conf
instance. - Throws:
MissingConfException
- if no parameter can be found for the specified path.
-
getSubConfList
List<Conf> getSubConfList(String path)
Gets a required parameter as a list ofConf
.- Parameters:
path
- the parameter path.- Returns:
- a new list of
Conf
instances. - Throws:
MissingConfException
- if no parameter can be found for the specified path.
-
hasPath
boolean hasPath(String path)
Checks whether the specified path exists into thisConf
.- Parameters:
path
- the path to be checked.- Returns:
true
if the path exists,false
otherwise.
-
getClasses
<T> Collection<T> getClasses(String path, Class<T> type)
Gets a required parameter as a list of instances of typeConf
.- Type Parameters:
T
- the expected type.- Parameters:
path
- the parameter path.type
- the class of the .- Returns:
- a new
Collection
ofConf
. - Throws:
MissingConfException
- if no parameter can be found for the specified path.
-
getClass
<T> T getClass(String path, Class<T> type)
Gets a required parameter as an instances of typeConf
.- Type Parameters:
T
- the expected type.- Parameters:
path
- the parameter path.type
- the class of the .- Returns:
- a new
Collection
ofConf
. - Throws:
MissingConfException
- if no parameter can be found for the specified path.
-
getConfAsMap
Map<String,Object> getConfAsMap()
Converts thisConf
into a path-value map.- Returns:
- a new
Map
instance containing the configuration values.
-
getConfAsProperties
Properties getConfAsProperties()
Converts thisConf
into a properties.- Returns:
- a new
Properties
instance containing the configuration values.
-
-