public class BasicConfigInheritance extends java.lang.Object implements ConfigInheritance
ConfigInheritance.ConfigInheritanceContext, ConfigInheritance.InheritanceMode, ConfigInheritance.Legacy
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONFLICT_RESOLUTION_STRATEGY_DEEP_MERGE |
static java.lang.String |
CONFLICT_RESOLUTION_STRATEGY_OVERWRITE |
static BasicConfigInheritance |
DEEP_MERGE
Indicates that if a key has a value at both an ancestor and a descendant, the descendant and his descendants
should attempt to merge the values.
|
static BasicConfigInheritance |
NEVER_INHERITED
Indicates that a key's value should never be inherited, even if defined on a container that does not know the key.
|
static BasicConfigInheritance |
NOT_REINHERITED
Indicates that a config key value should not be passed down from a container where it is defined.
|
static BasicConfigInheritance |
NOT_REINHERITED_ELSE_DEEP_MERGE
As
NOT_REINHERITED but in cases where a value is inherited because a parent did not recognize it,
if the inheritor also defines a value the two values should be merged. |
static BasicConfigInheritance |
OVERWRITE
Indicates that if a key has a value at both an ancestor and a descendant, the descendant and his descendants
will prefer the value at the descendant.
|
ALWAYS, NONE
Modifier and Type | Method and Description |
---|---|
<TContainer,TValue> |
considerParent(ConfigValueAtContainer<TContainer,TValue> local,
ConfigValueAtContainer<TContainer,TValue> parent,
ConfigInheritance.ConfigInheritanceContext context)
Returns whether any value from the parent or its ancestors should be considered
by the given local container, according to the
ConfigInheritance defined there. |
java.lang.String |
getConflictResolutionStrategy() |
boolean |
getUseLocalDefaultValue() |
ConfigInheritance.InheritanceMode |
isInherited(ConfigKey<?> key,
java.lang.Object from,
java.lang.Object to)
Deprecated.
|
<TContainer,TValue> |
isReinheritable(ConfigValueAtContainer<TContainer,TValue> parent,
ConfigInheritance.ConfigInheritanceContext context)
Returns whether any value from the given node or ancestors can be considered
for inheritance by descendants, according to the
ConfigInheritance defined there. |
boolean |
isReinherited() |
<TContainer,TValue> |
resolveWithParent(ConfigValueAtContainer<TContainer,TValue> local,
ConfigValueAtContainer<TContainer,TValue> parent,
ConfigInheritance.ConfigInheritanceContext context)
Returns the result after inheritance between the local container and a "resolveParent"
representation of the parent's evaluation of the key considering its ancestors.
|
java.lang.String |
toString() |
public static final java.lang.String CONFLICT_RESOLUTION_STRATEGY_DEEP_MERGE
public static final java.lang.String CONFLICT_RESOLUTION_STRATEGY_OVERWRITE
public static BasicConfigInheritance NOT_REINHERITED
NEVER_INHERITED
these values can be passed down if set as anonymous keys at a container
(ie the container does not expect it) to a container which does expect it, but it will not be passed down further.
If the inheritor also defines a value the parent's value is ignored irrespective
(as in OVERWRITE
; see NOT_REINHERITED_ELSE_DEEP_MERGE
if merging is desired).public static BasicConfigInheritance NOT_REINHERITED_ELSE_DEEP_MERGE
NOT_REINHERITED
but in cases where a value is inherited because a parent did not recognize it,
if the inheritor also defines a value the two values should be merged.public static BasicConfigInheritance NEVER_INHERITED
NOT_REINHERITED
.public static BasicConfigInheritance OVERWRITE
public static BasicConfigInheritance DEEP_MERGE
@Deprecated public ConfigInheritance.InheritanceMode isInherited(ConfigKey<?> key, java.lang.Object from, java.lang.Object to)
isInherited
in interface ConfigInheritance
public <TContainer,TValue> boolean isReinheritable(ConfigValueAtContainer<TContainer,TValue> parent, ConfigInheritance.ConfigInheritanceContext context)
ConfigInheritance
ConfigInheritance
defined there.
Implementations should not normally consider the value here
as there may be other ancestors whose values have not yet been considered and are not supplied.
If there is a ConfigInheritance
defined at this node,
this method must be called on that instance and that instance only.
In that case it is an error to invoke this method on any other ConfigInheritance
instance.
If there is not one, the config generally should be considered reinheritable;
callers will typically not invoke this method from a descendant inheritance context.
Consumers will typically find the methods in ConfigInheritances
more convenient.
isReinheritable
in interface ConfigInheritance
public <TContainer,TValue> boolean considerParent(ConfigValueAtContainer<TContainer,TValue> local, ConfigValueAtContainer<TContainer,TValue> parent, ConfigInheritance.ConfigInheritanceContext context)
ConfigInheritance
ConfigInheritance
defined there.
This defines the ConfigInheritance
of the local container typically considering
the value of the key there.
Implementations should not normally consider the value of the parent
as there may be other ancestors whose values have not yet been considered and are not supplied,
but it may determine that a local value is sufficient to render it unnecessary to consider the parent.
If there is a ConfigInheritance
defined at the local container,
this method must be called on that instance and that instance only.
In that case it is an error to invoke this method on any other ConfigInheritance
instance.
Consumers should consider this in conjuction with the
ConfigInheritance.isReinheritable(ConfigValueAtContainer, ConfigInheritanceContext)
status of the parent (if present).
Implementers need not duplicate a call to that method.
Consumers will typically find the methods in ConfigInheritances
more convenient.
considerParent
in interface ConfigInheritance
public <TContainer,TValue> ReferenceWithError<ConfigValueAtContainer<TContainer,TValue>> resolveWithParent(ConfigValueAtContainer<TContainer,TValue> local, ConfigValueAtContainer<TContainer,TValue> parent, ConfigInheritance.ConfigInheritanceContext context)
ConfigInheritance
ConfigInheritance.considerParent(ConfigValueAtContainer, ConfigValueAtContainer, ConfigInheritanceContext)
on the local node and ConfigInheritance.isReinheritable(ConfigValueAtContainer, ConfigInheritanceContext)
on the original parent node,
and then ConfigInheritance.resolveWithParent(ConfigValueAtContainer, ConfigValueAtContainer, ConfigInheritanceContext)
on the original parent node with its respective resolvedParent.
If there is a ConfigInheritance
defined at the local container,
this method must be called on that instance and that instance only.
In that case it is an error to invoke this method on any other ConfigInheritance
instance.
Consumers will typically find the methods in ConfigInheritances
more convenient.
resolveWithParent
in interface ConfigInheritance
public boolean isReinherited()
public java.lang.String getConflictResolutionStrategy()
public boolean getUseLocalDefaultValue()
public java.lang.String toString()
toString
in class java.lang.Object