Interface NodeResolver
-
public interface NodeResolver
A function to resolve nodes for a specific field.A
NodeResolver.Factory
is responsible for creating node resolvers for each field in an object, and provides the context necessary for a resolver to determine which node to navigate to.- Since:
- 4.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
NodeResolver.Factory
Provides fields.
-
Field Summary
Fields Modifier and Type Field Description static NodeResolver
SKIP_FIELD
Indicates that a field should be explicitly skipped.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static NodeResolver.Factory
keyFromSetting()
Creates resolvers that get the node at a key defined bySetting
.static NodeResolver.Factory
nodeFromParent()
A resolver that uses the containing node of a field.static NodeResolver.Factory
nodeKey()
Creates resolvers that provide the key of the containing node for values.static NodeResolver.Factory
onlyWithAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
A resolver that skips any field not annotated withannotation
.static NodeResolver.Factory
onlyWithSetting()
A resolver that will skip any field not annotated withSetting
.@Nullable ConfigurationNode
resolve(ConfigurationNode parent)
Given a parent node, resolve an appropriate child.
-
-
-
Field Detail
-
SKIP_FIELD
static final NodeResolver SKIP_FIELD
Indicates that a field should be explicitly skipped.- Since:
- 4.0.0
-
-
Method Detail
-
resolve
@Nullable ConfigurationNode resolve(ConfigurationNode parent)
Given a parent node, resolve an appropriate child.The
parent
node is the node that the mapped object is being deserialized from.- Parameters:
parent
- parent node- Returns:
- child node, or null if the node should not be deserialized.
- Since:
- 4.0.0
-
nodeKey
static NodeResolver.Factory nodeKey()
Creates resolvers that provide the key of the containing node for values.- Returns:
- key-based resolver
- Since:
- 4.0.0
-
keyFromSetting
static NodeResolver.Factory keyFromSetting()
Creates resolvers that get the node at a key defined bySetting
.- Returns:
- a factory that will extract keys from a provided annotation
- Since:
- 4.0.0
-
onlyWithAnnotation
static NodeResolver.Factory onlyWithAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
A resolver that skips any field not annotated withannotation
.- Parameters:
annotation
- annotation to require- Returns:
- a new resolver
- Since:
- 4.0.0
-
onlyWithSetting
static NodeResolver.Factory onlyWithSetting()
A resolver that will skip any field not annotated withSetting
.- Returns:
- new resolver restricting fields
- Since:
- 4.0.0
-
nodeFromParent
static NodeResolver.Factory nodeFromParent()
A resolver that uses the containing node of a field.This can be used to combine multiple Java objects into one configuration node.
- Returns:
- new resolver using containing field value
- Since:
- 4.0.0
-
-