public interface ConfigInheritance
extends java.io.Serializable
Modifier and Type | Interface and Description |
---|---|
static interface |
ConfigInheritance.ConfigInheritanceContext
marker interface for inheritance contexts, for keys which can define one or more inheritance patterns;
implementers can define their own, e.g.
|
static class |
ConfigInheritance.InheritanceMode
Deprecated.
since 0.10.0 see implementations of this interface
|
static class |
ConfigInheritance.Legacy
Deprecated.
since 0.10.0 see implementations of this interface
|
Modifier and Type | Field and Description |
---|---|
static ConfigInheritance |
ALWAYS
Deprecated.
since 0.10.0 see implementations of this interface (look for OVERWRITE)
|
static ConfigInheritance |
DEEP_MERGE
Deprecated.
since 0.10.0 see implementations of this interface (look for the same name, DEEP_MERGE)
|
static ConfigInheritance |
NONE
Deprecated.
since 0.10.0 see implementations of this interface (look for NOT_REINHERITED, or possibly NEVER_REINHERITED)
|
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. |
ConfigInheritance.InheritanceMode |
isInherited(ConfigKey<?> key,
java.lang.Object from,
java.lang.Object to)
Deprecated.
since 0.10.0 more complex inheritance conditions now require other methods
|
<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. |
<TContainer,TValue> |
resolveWithParent(ConfigValueAtContainer<TContainer,TValue> local,
ConfigValueAtContainer<TContainer,TValue> resolvedParent,
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.
|
@Deprecated static final ConfigInheritance NONE
@Deprecated static final ConfigInheritance ALWAYS
@Deprecated static final ConfigInheritance DEEP_MERGE
@Deprecated ConfigInheritance.InheritanceMode isInherited(ConfigKey<?> key, java.lang.Object from, java.lang.Object to)
<TContainer,TValue> boolean isReinheritable(@Nullable ConfigValueAtContainer<TContainer,TValue> parent, ConfigInheritance.ConfigInheritanceContext context)
ConfigInheritance
defined there.
The implementation of this method is usually a constant depending on the inheritance in effect;
in particular it will not normally consider any values or inform whether something should be inherited:
it is only advising whether inheritance is permitted from a given point in the inheritance hierarchy.
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.
Key inference (continuing from the above): Callers should not try to infer any descendant key and look at what it says about reinheritability; if a container does not define a key it would be pointless for it not to be reinheritable).
Consumers will typically find the methods in ConfigInheritances
more convenient.
<TContainer,TValue> boolean considerParent(@Nonnull ConfigValueAtContainer<TContainer,TValue> local, @Nullable ConfigValueAtContainer<TContainer,TValue> parent, ConfigInheritance.ConfigInheritanceContext context)
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.
Key inference: if a container does not define a key, the inheritance in the key definition in the nearest descendant of that container should be used.
Consumers should consider this in conjuction with the
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.
<TContainer,TValue> ReferenceWithError<ConfigValueAtContainer<TContainer,TValue>> resolveWithParent(@Nonnull ConfigValueAtContainer<TContainer,TValue> local, @Nonnull ConfigValueAtContainer<TContainer,TValue> resolvedParent, ConfigInheritance.ConfigInheritanceContext context)
considerParent(ConfigValueAtContainer, ConfigValueAtContainer, ConfigInheritanceContext)
on the local node and isReinheritable(ConfigValueAtContainer, ConfigInheritanceContext)
on the original parent node,
and then 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.
Key inference: if a container does not define a key, the inheritance in the key definition in the nearest descendant of that container should be used.
Consumers will typically find the methods in ConfigInheritances
more convenient.