Interface Conf
-
- All Known Implementing Classes:
AbstractConf,ArgsConf,ConfBuilder,EmptyConf,MapConf,Property
public interface ConfClass 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 Confempty()Static helper that can be used to creates a new emptyConfinstance.booleangetBoolean(String path)Gets a required parameter as an boolean.<T> TgetClass(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 thisConfinto a path-value map.PropertiesgetConfAsProperties()Converts thisConfinto a properties.doublegetDouble(String path)Gets a required parameter as a double.intgetInt(String path)Gets a required parameter as an integer.longgetLong(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.StringgetString(String path)Gets a required parameter a a string.List<String>getStringList(String path)Gets a required parameter as a list.ConfgetSubConf(String path)Gets a required parameter as aConf.List<Conf>getSubConfList(String path)Gets a required parameter as a list ofConf.booleanhasPath(String path)Checks whether the specified path exists into thisConf.static Confwith(String path, Object value)Static helper that can be used to creates a new emptyConfinstance using the specified key-value pair.static Confwith(Map<String,?> map)ConfwithFallback(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 emptyConfinstance using the specified key-value pair.- Returns:
- a new
Confinstance.
-
empty
static Conf empty()
Static helper that can be used to creates a new emptyConfinstance.- Returns:
- a new
Confinstance.
-
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
Optionalvalue.
-
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
Optionalvalue.
-
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
Optionalvalue.
-
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
Optionalvalue.
-
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
Optionalvalue.
-
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
Confinstance. - 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
Confinstances. - 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:
trueif the path exists,falseotherwise.
-
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
CollectionofConf. - 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
CollectionofConf. - Throws:
MissingConfException- if no parameter can be found for the specified path.
-
getConfAsMap
Map<String,Object> getConfAsMap()
Converts thisConfinto a path-value map.- Returns:
- a new
Mapinstance containing the configuration values.
-
getConfAsProperties
Properties getConfAsProperties()
Converts thisConfinto a properties.- Returns:
- a new
Propertiesinstance containing the configuration values.
-
-