public static class ConfigInheritances.BasicConfigValueAtContainer<TContainer,TValue> extends java.lang.Object implements ConfigValueAtContainer<TContainer,TValue>
Constructor and Description |
---|
BasicConfigValueAtContainer() |
BasicConfigValueAtContainer(ConfigValueAtContainer<TContainer,TValue> toCopy) |
BasicConfigValueAtContainer(TContainer container,
ConfigKey<? extends TValue> key,
Maybe<? extends TValue> value) |
BasicConfigValueAtContainer(TContainer container,
ConfigKey<? extends TValue> key,
Maybe<? extends TValue> value,
boolean isValueSet) |
BasicConfigValueAtContainer(TContainer container,
ConfigKey<? extends TValue> key,
Maybe<? extends TValue> value,
boolean isValueSet,
Maybe<TValue> defaultValue)
Creates an instance, configuring all parameters.
|
Modifier and Type | Method and Description |
---|---|
Maybe<? extends TValue> |
asMaybe()
Absent if no value can be found, typically meaning no default value, but in raw value lookups it may ignore default values.
|
TValue |
get()
Returns the value for this key, or null.
|
TContainer |
getContainer()
The container where the value was found (possibly an ancestor of the queried object).
|
Maybe<TValue> |
getDefaultValue()
The default value on the key, if available and permitted,
possibly coerced or resolved in the scope of
ConfigValueAtContainer.getContainer() ,
and possibly absent e.g. |
ConfigKey<? extends TValue> |
getKey()
The key whose value is being held here.
|
boolean |
isValueExplicitlySet()
If false, any contents of
ConfigValueAtContainer.get() will have come from ConfigValueAtContainer.getDefaultValue() . |
void |
setContainer(TContainer container) |
void |
setKey(ConfigKey<? extends TValue> key) |
void |
setValue(Maybe<? extends TValue> value) |
void |
setValueWasExplicitlySet(boolean valueWasExplicitlySet) |
java.lang.String |
toString() |
public BasicConfigValueAtContainer()
public BasicConfigValueAtContainer(ConfigValueAtContainer<TContainer,TValue> toCopy)
public BasicConfigValueAtContainer(@Nullable TContainer container, @Nullable ConfigKey<? extends TValue> key, @Nullable Maybe<? extends TValue> value)
public BasicConfigValueAtContainer(@Nullable TContainer container, @Nullable ConfigKey<? extends TValue> key, @Nullable Maybe<? extends TValue> value, boolean isValueSet)
public BasicConfigValueAtContainer(@Nullable TContainer container, @Nullable ConfigKey<? extends TValue> key, @Nullable Maybe<? extends TValue> value, boolean isValueSet, @Nullable Maybe<TValue> defaultValue)
container
- May be null as per contract.key
- May be null as per contract.value
- Null means always to take getDefaultValue()
; if absent and isValueSet is false, it will also take getDefaultValue()
.isValueSet
- defaultValue
- Null means to take a default value from the key (getKey()
), otherwise this Maybe
will be preferred to that value
(even if absent).public TContainer getContainer()
ConfigValueAtContainer
getContainer
in interface ConfigValueAtContainer<TContainer,TValue>
public TValue get()
ConfigValueAtContainer
ConfigValueAtContainer.asMaybe()
or null.get
in interface ConfigValueAtContainer<TContainer,TValue>
public Maybe<? extends TValue> asMaybe()
ConfigValueAtContainer
asMaybe
in interface ConfigValueAtContainer<TContainer,TValue>
public boolean isValueExplicitlySet()
ConfigValueAtContainer
ConfigValueAtContainer.get()
will have come from ConfigValueAtContainer.getDefaultValue()
.isValueExplicitlySet
in interface ConfigValueAtContainer<TContainer,TValue>
public ConfigKey<? extends TValue> getKey()
ConfigValueAtContainer
This may be null when working in a context where the query key is widely known to indicate that no key was defined at this container.
getKey
in interface ConfigValueAtContainer<TContainer,TValue>
public void setContainer(TContainer container)
public void setValueWasExplicitlySet(boolean valueWasExplicitlySet)
public Maybe<TValue> getDefaultValue()
ConfigValueAtContainer
ConfigValueAtContainer.getContainer()
,
and possibly absent e.g. in raw value lookupsgetDefaultValue
in interface ConfigValueAtContainer<TContainer,TValue>
public java.lang.String toString()
toString
in class java.lang.Object