Package se.sics.kompics.config
Class Config.Impl
java.lang.Object
se.sics.kompics.config.Config.Impl
- All Implemented Interfaces:
Config
- Enclosing interface:
- Config
public static class Config.Impl extends Object implements Config
-
Nested Class Summary
Nested classes/interfaces inherited from interface se.sics.kompics.config.Config
Config.Builder, Config.Factory, Config.Impl
-
Method Summary
Modifier and Type Method Description void
apply(ConfigUpdate update, Optional<ValueMerger> customMergeLogic)
Config
copy(boolean newVersionLine)
<T> T
getValue(String key, Class<T> type)
Return the value atkey
asT
ornull
if none.<T> T
getValueOrDefault(String key, T defaultValue)
Return the value atkey
asT
ordefaultValue
if none.<T> List<T>
getValues(String key)
Returns a list of values at @{code key}.<T> List<T>
getValues(String key, Class<T> type)
Returns a list of values at @{code key}.Config.Builder
modify(UUID author)
<T> Optional<T>
readValue(String key)
Returns anOptional
of the value atkey
asT
orAbsent<T>
if none.<T> Optional<T>
readValue(String key, Class<T> type)
Returns anOptional
of the value atkey
asT
orAbsent<T>
if none.
-
Method Details
-
readValue
Description copied from interface:Config
Returns anOptional
of the value atkey
asT
orAbsent<T>
if none.Does not perform checked casting!
-
readValue
Description copied from interface:Config
Returns anOptional
of the value atkey
asT
orAbsent<T>
if none.Performs checked casting against
type
. -
getValue
Description copied from interface:Config
Return the value atkey
asT
ornull
if none.Performs checked casting against
type
.- Specified by:
getValue
in interfaceConfig
- Type Parameters:
T
- The requested type of the value- Parameters:
key
- The location of the valuetype
- The type to cast the value to- Returns:
- The value as
T
if present ornull
otherwise - Throws:
ClassCastException
- if the value can not be cast totype
-
getValueOrDefault
Description copied from interface:Config
Return the value atkey
asT
ordefaultValue
if none.Performs checked casting against the type of
defaultValue
.- Specified by:
getValueOrDefault
in interfaceConfig
- Type Parameters:
T
- The requested type of the value- Parameters:
key
- The location of the valuedefaultValue
- Returned if there is not value of the right type atkey
- Returns:
- The value as
T
if present ordefaultValue
otherwise
-
modify
-
getValues
Description copied from interface:Config
Returns a list of values at @{code key}.The casts to
T
are unchecked in this method. UseConfig.getValues(java.lang.String, java.lang.Class)
if you don't want this behaviour. -
getValues
Description copied from interface:Config
Returns a list of values at @{code key}.Value casts are checked against
type
. May throw a @{link se.sics.kompics.config.ConfigValueException } if a value can't be cast. -
copy
-
apply
-