Interface ConfigurationNode
- All Known Subinterfaces:
- AttributedConfigurationNode,- BasicConfigurationNode,- CommentedConfigurationNode,- CommentedConfigurationNodeIntermediary<N>,- ScopedConfigurationNode<N>
All aspects of a configurations structure are represented using instances
 of ConfigurationNode, and the links between them.
ConfigurationNodes can hold different types of value. They can:
- Hold a single "scalar" value (accessed by rawScalar()
- Represent a "list" of child ConfigurationNodes (accessed byisList()andchildrenList())
- Represent a "map" of child ConfigurationNodes (accessed byisMap()andchildrenMap())
- Hold no value at all (when virtual()is true)
The overall configuration stems from a single "root" node, which is
 provided by the ConfigurationLoader, or by other means programmatically.
- Since:
- 4.0.0
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intDefault value for unknown number results.
- 
Method SummaryModifier and TypeMethodDescriptionGets a new child node created as the next entry in the list.List<? extends ConfigurationNode>Gets the "list children" attached to this node, if it has any.Map<Object,? extends ConfigurationNode> Gets the "map children" attached to this node, if it has any.copy()Creates a deep copy of this node.booleanempty()Return true when this node has a null or empty value.from(ConfigurationNode other) Apply all data fromotherto this node, overwriting any existing data.default <V> @Nullable Vget(io.leangen.geantyref.TypeToken<V> type) Get the current value associated with this node.default <V> VGet the current value associated with this node.default <V> Vget(io.leangen.geantyref.TypeToken<V> type, V def) Get the current value associated with this node.default <V> @Nullable VGet the current value associated with this node.default <V> VGet the current value associated with this node.default <V> VGet the current value associated with this node.@Nullable Objectget(AnnotatedType type) Get the current value associated with this node.get(AnnotatedType type, Object def) Get the current value associated with this node.get(AnnotatedType type, Supplier<?> defSupplier) Get the current value associated with this node.@Nullable ObjectGet the current value associated with this node.Get the current value associated with this node.Get the current value associated with this node.default booleanGets the value typed using the appropriate type conversion fromScalars.default booleangetBoolean(boolean def) Gets the value typed using the appropriate type conversion fromScalars.default doubleGets the value typed using the appropriate type conversion fromScalars.default doublegetDouble(double def) Gets the value typed using the appropriate type conversion fromScalars.default floatgetFloat()Gets the value typed using the appropriate type conversion fromScalars.default floatgetFloat(float def) Gets the value typed using the appropriate type conversion fromScalars.default intgetInt()Gets the value typed using the appropriate type conversion fromScalars.default intgetInt(int def) Gets the value typed using the appropriate type conversion fromScalars.default <V> @Nullable List<V>getList(io.leangen.geantyref.TypeToken<V> type) If this node has list values, this function unwraps them and converts them to an appropriate type based on the provided function.default <V> List<V>If this node has list values, this function unwraps them and converts them to an appropriate type based on the provided function.default <V> List<V>If this node has list values, this function unwraps them and converts them to an appropriate type based on the provided function.default <V> @Nullable List<V>If this node has list values, this function unwraps them and converts them to an appropriate type based on the provided function.default <V> List<V>If this node has list values, this function unwraps them and converts them to an appropriate type based on the provided function.default <V> List<V>If this node has list values, this function unwraps them and converts them to an appropriate type based on the provided function.default longgetLong()Gets the value typed using the appropriate type conversion fromScalars.default longgetLong(long def) Gets the value typed using the appropriate type conversion fromScalars.default @Nullable StringGets the value typed using the appropriate type conversion fromScalars.default StringGets the value typed using the appropriate type conversion fromScalars.booleanChecks whether or not a non-virtual node is present at the relative pathpath.booleanChecks whether or not a non-virtual node is present at the relative pathpath.<V> @Nullable Vhint(RepresentationHint<V> hint) Query a representation hint from this node.hint(RepresentationHint<V> hint, @Nullable V value) Set a representation hint on this node.booleanisList()Gets if this node has "list children".booleanisMap()Gets if this node has "map children".booleanisNull()Get if this node has a 'null' value.@Nullable Objectkey()Gets the "key" of this node.mergeFrom(ConfigurationNode other) Set all the values from the given node that are not present in this node to their values in the provided node.Gets the node at the given (relative) path, possibly traversing multiple levels of nodes.Gets the node at the given (relative) path, possibly traversing multiple levels of nodes.options()Gets the options that currently apply to this node.<V> @Nullable VownHint(RepresentationHint<V> hint) Query a representation hint from this node.Map<RepresentationHint<?>,?> ownHints()Get an unmodifiable copy of representation hints stored on this node.@Nullable ConfigurationNodeparent()Gets the parent of this node.path()Gets the full path ofkeysfrom the root node to this node.@Nullable Objectraw()Get the raw value of this node.Set the raw value of this node.@Nullable ObjectGet the raw value of this node if the node is a scalar.booleanremoveChild(Object key) Removes a direct child of this node.default <V> Vrequire(io.leangen.geantyref.TypeToken<V> type) Get the current value associated with this node, asserting that it is non-null.default <V> VGet the current value associated with this node, asserting that it is non-null.default ObjectGet the current value associated with this node, asserting that it is non-null.Set this node's value to the given value.set(io.leangen.geantyref.TypeToken<V> type, @Nullable V value) Set this node's value to the given value.Set this node's value to the given value.set(AnnotatedType type, @Nullable Object value) Set this node's value to the given value.Set this node's value to the given value.default <V> ConfigurationNodeSet the node's value to the provided list.default <V> ConfigurationNodeSet the node's value to the provided list.default <V> Collector<V,? extends ConfigurationNode, ? extends ConfigurationNode> toListCollector(io.leangen.geantyref.TypeToken<V> valueType) Create a collector that appends values to this node as list children.default <V> Collector<V,? extends ConfigurationNode, ? extends ConfigurationNode> toListCollector(Class<V> valueType) Create a collector that appends values to this node as list children.default <V> Collector<Map.Entry<?,V>, ? extends ConfigurationNode, ? extends ConfigurationNode> toMapCollector(io.leangen.geantyref.TypeToken<V> valueType) Create a collector that appends values to this node as map children.default <V> Collector<Map.Entry<?,V>, ? extends ConfigurationNode, ? extends ConfigurationNode> toMapCollector(Class<V> valueType) Create a collector that appends values to this node as map children.booleanvirtual()Gets if this node is virtual.default <S,T> T visit(ConfigurationVisitor.Safe<S, T> visitor) Visit this node hierarchy as described inConfigurationVisitor.<S,T> T visit(ConfigurationVisitor.Safe<S, T> visitor, S state) Visit this node hierarchy as described inConfigurationVisitor.default <S,T, E extends Exception> 
 Tvisit(ConfigurationVisitor<S, T, E> visitor) Visit this node hierarchy as described inConfigurationVisitor.<S,T, E extends Exception> 
 Tvisit(ConfigurationVisitor<S, T, E> visitor, S state) Visit this node hierarchy as described inConfigurationVisitor.
- 
Field Details- 
NUMBER_DEFDefault value for unknown number results.- Since:
- 4.0.0
- See Also:
 
 
- 
- 
Method Details- 
keyGets the "key" of this node.The key determines this ConfigurationNodes position within the overall configuration structure.If this node is currently virtual, this method's result may be inaccurate.Note that this method only returns the nearest "link" in the hierarchy, and does not return a representation of the full path. See path()for that.The ConfigurationNodes returned as values fromchildrenMap()will have keys derived from their pairing in the map node.The ConfigurationNodes returned fromchildrenList()will have keys derived from their position (index) in the list node.- Returns:
- the key of this node
- Since:
- 4.0.0
 
- 
pathGets the full path ofkeysfrom the root node to this node.Node implementations may not keep a full path for each node, so this method may be somewhat complex to calculate. Most uses should not need to calculate the full path unless providing debug information - Returns:
- an array compiled from the keys for each node up the hierarchy
- Since:
- 4.0.0
 
- 
parent@Nullable ConfigurationNode parent()Gets the parent of this node.If this node is currently virtual, this method's result may be inaccurate.- Returns:
- the nodes parent
- Since:
- 4.0.0
 
- 
nodeGets the node at the given (relative) path, possibly traversing multiple levels of nodes.This is the main method used to navigate through the configuration. The path parameter effectively consumes an array of keys, which locate the unique position of a given node within the structure. Each element will navigate one level down in the configuration hierarchy A node is always returned by this method. If the given node does not exist in the structure, a virtualnode will be returned which represents the position.- Parameters:
- path- the path to fetch the node at
- Returns:
- the node at the given path, possibly virtual
- Since:
- 4.0.0
 
- 
nodeGets the node at the given (relative) path, possibly traversing multiple levels of nodes.This is the main method used to navigate through the configuration. The path parameter effectively consumes an array of keys, which locate the unique position of a given node within the structure. A node is always returned by this method. If the given node does not exist in the structure, a virtualnode will be returned which represents the position.- Parameters:
- path- the path to fetch the node at
- Returns:
- the node at the given path, possibly virtual
- Since:
- 4.0.0
 
- 
hasChildChecks whether or not a non-virtual node is present at the relative pathpath.This allows checking for more remote nodes in the configuration hierarchy without having to instantiate new unattached node objects. - Parameters:
- path- path to search at
- Returns:
- if a non-virtual child is present
- Since:
- 4.0.0
 
- 
hasChildChecks whether or not a non-virtual node is present at the relative pathpath.This allows checking for more remote nodes in the configuration hierarchy without having to instantiate new unattached node objects. - Parameters:
- path- path to search at
- Returns:
- if a non-virtual child is present
- Since:
- 4.0.0
 
- 
virtualboolean virtual()Gets if this node is virtual.Virtual nodes are nodes which are not attached to a wider configuration structure. A node is primarily "virtual" when it has no set value. - Returns:
- trueif this node is virtual
- Since:
- 4.0.0
 
- 
optionsGets the options that currently apply to this node.- Returns:
- the ConfigurationOptionsinstance controlling the functionality of this node.
- Since:
- 4.0.0
 
- 
isNullboolean isNull()Get if this node has a 'null' value.This generally overlaps with the value of virtual(), but may be distinct in situations where the node has additional metadata (comment, attributes, etc).- Returns:
- whether this node
- Since:
- 4.1.0
 
- 
isListboolean isList()Gets if this node has "list children".- Returns:
- if this node has children in the form of a list
- Since:
- 4.0.0
 
- 
isMapboolean isMap()Gets if this node has "map children".- Returns:
- if this node has children in the form of a map
- Since:
- 4.0.0
 
- 
emptyboolean empty()Return true when this node has a null or empty value.Values that may result in this method returning true include: - null
- the empty string
- an empty map
- an empty list
- Any other type of empty collection
 This is a separate value from virtual(). Emptiness refers to the value of this node itself, while virtuality refers to whether or not this node is attached to a configuration structure.- Returns:
- whether this node is empty
- Since:
- 4.0.0
 
- 
childrenListList<? extends ConfigurationNode> childrenList()Gets the "list children" attached to this node, if it has any.If this node does not have list children, an empty list is returned.- Returns:
- the list children currently attached to this node
- Since:
- 4.0.0
 
- 
childrenMapMap<Object,? extends ConfigurationNode> childrenMap()Gets the "map children" attached to this node, if it has any.If this node does not have map children, an empty map returned.- Returns:
- the map children currently attached to this node
- Since:
- 4.0.0
 
- 
toMapCollectordefault <V> Collector<Map.Entry<?,V>, toMapCollector? extends ConfigurationNode, ? extends ConfigurationNode> (io.leangen.geantyref.TypeToken<V> valueType) Create a collector that appends values to this node as map children.This collector does not accept values in parallel. - Type Parameters:
- V- value type
- Parameters:
- valueType- marker for value type
- Returns:
- a new collector
- Since:
- 4.0.0
 
- 
toMapCollectordefault <V> Collector<Map.Entry<?,V>, toMapCollector? extends ConfigurationNode, ? extends ConfigurationNode> (Class<V> valueType) Create a collector that appends values to this node as map children.This collector does not accept values in parallel. - Type Parameters:
- V- value type
- Parameters:
- valueType- marker for value type
- Returns:
- a new collector
- Since:
- 4.0.0
 
- 
toListCollectordefault <V> Collector<V,? extends ConfigurationNode, toListCollector? extends ConfigurationNode> (io.leangen.geantyref.TypeToken<V> valueType) Create a collector that appends values to this node as list children.This collector does not accept values in parallel. - Type Parameters:
- V- value type
- Parameters:
- valueType- marker for value type
- Returns:
- a new collector
- Since:
- 4.0.0
 
- 
toListCollectordefault <V> Collector<V,? extends ConfigurationNode, toListCollector? extends ConfigurationNode> (Class<V> valueType) Create a collector that appends values to this node as list children.This collector does not accept values in parallel. - Type Parameters:
- V- value type
- Parameters:
- valueType- marker for value type
- Returns:
- a new collector
- Since:
- 4.0.0
 
- 
requireGet the current value associated with this node, asserting that it is non-null.This method can be used when it is known that a certain key exists, or when implicit initialization is enabled for the expected typeThis method will perform deserialization using the appropriate TypeSerializerfor the given type, or attempting to cast if no type serializer is found.- Type Parameters:
- V- the type to get
- Parameters:
- type- the type to deserialize to
- Returns:
- the value if present and of the proper type
- Throws:
- NoSuchElementException- if the returned value is null
- SerializationException- if the value fails to be converted to the requested type
- Since:
- 4.1.0
 
- 
requireGet the current value associated with this node, asserting that it is non-null.This method can be used when it is known that a certain key exists, or when implicit initialization is enabled for the expected typeThis method will also perform deserialization using the appropriate TypeSerializerfor the given type, or casting if no type serializer is found.- Type Parameters:
- V- the type to get
- Parameters:
- type- the type to deserialize to
- Returns:
- the value if present and of the proper type
- Throws:
- NoSuchElementException- if the returned value is null
- SerializationException- if the value fails to be converted to the requested type
- Since:
- 4.1.0
 
- 
requireGet the current value associated with this node, asserting that it is non-null.This method can be used when it is known that a certain key exists, or when implicit initialization is enabled for the expected typeThis method will attempt to deserialize the node's value to the provided Typeusing a configuredTypeSerializerfor the given type, or casting if no type serializer is found.- Parameters:
- type- the type to deserialize to
- Returns:
- the value if present and of the proper type
- Throws:
- NoSuchElementException- if the returned value is null
- SerializationException- if the value fails to be converted to the requested type
- Since:
- 4.1.0
 
- 
getGet the current value associated with this node.This method will perform deserialization using the appropriate TypeSerializerfor the given type, or attempting to cast if no type serializer is found.- Type Parameters:
- V- the type to get
- Parameters:
- type- the type to deserialize to
- Returns:
- the value if present and of the proper type, else null
- Throws:
- SerializationException- if the value fails to be converted to the requested type
- Since:
- 4.0.0
 
- 
getGet the current value associated with this node.This method will also perform deserialization using the appropriate TypeSerializerfor the given type, or casting if no type serializer is found.- Type Parameters:
- V- the type to get
- Parameters:
- type- the type to deserialize as.
- def- value to return if- virtual()or value is not of appropriate type
- Returns:
- the value if of the proper type, else def
- Throws:
- SerializationException- if the value fails to be converted to the requested type
- Since:
- 4.0.0
 
- 
getdefault <V> V get(io.leangen.geantyref.TypeToken<V> type, Supplier<V> defSupplier) throws SerializationException Get the current value associated with this node.This method will also perform deserialization using the appropriate TypeSerializer for the given type, or casting if no type serializer is found. - Type Parameters:
- V- the type to get
- Parameters:
- type- the type to deserialize to
- defSupplier- the function that will be called to calculate a default value only if there is no existing value of the correct type
- Returns:
- the value if of the proper type, else def
- Throws:
- SerializationException- if the value fails to be converted to the requested type
- Since:
- 4.0.0
 
- 
getGet the current value associated with this node.This method will also perform deserialization using the appropriate TypeSerializerfor the given type, or casting if no type serializer is found.- Type Parameters:
- V- the type to get
- Parameters:
- type- the type to deserialize to
- Returns:
- the value if present and of the proper type, else null
- Throws:
- SerializationException- if the value fails to be converted to the requested type
- Since:
- 4.0.0
 
- 
getGet the current value associated with this node.This method will also perform deserialization using the appropriate TypeSerializerfor the given type, or casting if no type serializer is found.- Type Parameters:
- V- the type to get
- Parameters:
- type- the type to deserialize as.
- def- value to return if- virtual()or value is not of appropriate type
- Returns:
- the value if of the proper type, else def
- Throws:
- SerializationException- if the value fails to be converted to the requested type
- Since:
- 4.0.0
 
- 
getGet the current value associated with this node.This method will also perform deserialization using the appropriate TypeSerializer for the given type, or casting if no type serializer is found. - Type Parameters:
- V- the type to get
- Parameters:
- type- the type to deserialize to
- defSupplier- the function that will be called to calculate a default value only if there is no existing value of the correct type
- Returns:
- the value if of the proper type, else def
- Throws:
- SerializationException- if the value fails to be converted to the requested type
- Since:
- 4.0.0
 
- 
getGet the current value associated with this node.This method will attempt to deserialize the node's value to the provided AnnotatedTypeusing a configuredTypeSerializerfor the given type, or casting if no type serializer is found.- Parameters:
- type- the type to deserialize to
- Returns:
- the value if present and of the proper type, else null
- Throws:
- SerializationException- if the value fails to be converted to the requested type
- Since:
- 4.2.0
 
- 
getGet the current value associated with this node.This method will attempt to deserialize the node's value to the provided AnnotatedTypeusing a configuredTypeSerializerfor the given type, or casting if no type serializer is found.- Parameters:
- type- the type to deserialize as
- def- value to return if- virtual()or value is not of appropriate type
- Returns:
- the value if of the proper type, else def
- Throws:
- SerializationException- if the value fails to be converted to the requested type
- Since:
- 4.2.0
 
- 
getGet the current value associated with this node.This method will attempt to deserialize the node's value to the provided AnnotatedTypeusing a configuredTypeSerializerfor the given type, or casting if no type serializer is found.- Parameters:
- type- the type to deserialize to
- defSupplier- the function that will be called to calculate a default value only if there is no existing value of the correct type
- Returns:
- the value if of the proper type, else def
- Throws:
- SerializationException- if the value fails to be converted to the requested type
- Since:
- 4.2.0
 
- 
getGet the current value associated with this node.This method will attempt to deserialize the node's value to the provided Typeusing a configuredTypeSerializerfor the given type, or casting if no type serializer is found.- Parameters:
- type- the type to deserialize to
- Returns:
- the value if present and of the proper type, else null
- Throws:
- SerializationException- if the value fails to be converted to the requested type
- Since:
- 4.0.0
 
- 
getGet the current value associated with this node.This method will attempt to deserialize the node's value to the provided Typeusing a configuredTypeSerializerfor the given type, or casting if no type serializer is found.- Parameters:
- type- the type to deserialize as
- def- value to return if- virtual()or value is not of appropriate type
- Returns:
- the value if of the proper type, else def
- Throws:
- SerializationException- if the value fails to be converted to the requested type
- Since:
- 4.0.0
 
- 
getGet the current value associated with this node.This method will attempt to deserialize the node's value to the provided Typeusing a configuredTypeSerializerfor the given type, or casting if no type serializer is found.- Parameters:
- type- the type to deserialize to
- defSupplier- the function that will be called to calculate a default value only if there is no existing value of the correct type
- Returns:
- the value if of the proper type, else def
- Throws:
- SerializationException- if the value fails to be converted to the requested type
- Since:
- 4.0.0
 
- 
getListdefault <V> @Nullable List<V> getList(io.leangen.geantyref.TypeToken<V> type) throws SerializationException If this node has list values, this function unwraps them and converts them to an appropriate type based on the provided function.If this node has a scalar value, this function treats it as a list with one value. - Type Parameters:
- V- the expected type
- Parameters:
- type- the expected type
- Returns:
- an immutable copy of the values contained
- Throws:
- SerializationException- if any value fails to be converted to the requested type
- Since:
- 4.0.0
 
- 
getListdefault <V> List<V> getList(io.leangen.geantyref.TypeToken<V> elementType, List<V> def) throws SerializationException If this node has list values, this function unwraps them and converts them to an appropriate type based on the provided function.If this node has a scalar value, this function treats it as a list with one value. - Type Parameters:
- V- expected type
- Parameters:
- elementType- expected type
- def- default value if no appropriate value is set
- Returns:
- an immutable copy of the values contained that could be
         successfully converted, or defif no values could be converted.
- Throws:
- SerializationException- if any value fails to be converted to the requested type
- Since:
- 4.0.0
 
- 
getListdefault <V> List<V> getList(io.leangen.geantyref.TypeToken<V> elementType, Supplier<List<V>> defSupplier) throws SerializationException If this node has list values, this function unwraps them and converts them to an appropriate type based on the provided function.If this node has a scalar value, this function treats it as a list with one value. - Type Parameters:
- V- expected type
- Parameters:
- elementType- expected type
- defSupplier- function that will be called to calculate a default value only if there is no existing value of the correct type
- Returns:
- an immutable copy of the values contained that could be
         successfully converted, or defif no values could be converted.
- Throws:
- SerializationException- if any value fails to be converted to the requested type
- Since:
- 4.0.0
 
- 
getListIf this node has list values, this function unwraps them and converts them to an appropriate type based on the provided function.If this node has a scalar value, this function treats it as a list with one value. - Type Parameters:
- V- the expected type
- Parameters:
- type- the expected type
- Returns:
- an immutable copy of the values contained
- Throws:
- SerializationException- if any value fails to be converted to the requested type
- Since:
- 4.0.0
 
- 
getListIf this node has list values, this function unwraps them and converts them to an appropriate type based on the provided function.If this node has a scalar value, this function treats it as a list with one value. - Type Parameters:
- V- expected type
- Parameters:
- elementType- expected type
- def- default value if no appropriate value is set
- Returns:
- an immutable copy of the values contained that could be
         successfully converted, or defif no values could be converted.
- Throws:
- SerializationException- if any value fails to be converted to the requested type
- Since:
- 4.0.0
 
- 
getListdefault <V> List<V> getList(Class<V> elementType, Supplier<List<V>> defSupplier) throws SerializationException If this node has list values, this function unwraps them and converts them to an appropriate type based on the provided function.If this node has a scalar value, this function treats it as a list with one value. - Type Parameters:
- V- expected type
- Parameters:
- elementType- expected type
- defSupplier- function that will be called to calculate a default value only if there is no existing value of the correct type
- Returns:
- an immutable copy of the values contained that could be
         successfully converted, or defif no values could be converted.
- Throws:
- SerializationException- if any value fails to be converted to the requested type
- Since:
- 4.0.0
 
- 
getStringGets the value typed using the appropriate type conversion fromScalars.
- 
getStringGets the value typed using the appropriate type conversion fromScalars.
- 
getFloatGets the value typed using the appropriate type conversion fromScalars.- Returns:
- the value coerced to a float, or NUMBER_DEFif not a float
- Since:
- 4.0.0
- See Also:
 
- 
getFloatGets the value typed using the appropriate type conversion fromScalars.- Parameters:
- def- the default value if no appropriate value is set
- Returns:
- the value coerced to a float, or defif not a float
- Since:
- 4.0.0
- See Also:
 
- 
getDoubleGets the value typed using the appropriate type conversion fromScalars.- Returns:
- the value coerced to a double, or NUMBER_DEFif coercion failed
- Since:
- 4.0.0
- See Also:
 
- 
getDoubleGets the value typed using the appropriate type conversion fromScalars.- Parameters:
- def- the default value if no appropriate value is set
- Returns:
- the value coerced to a double, or defif coercion failed
- Since:
- 4.0.0
- See Also:
 
- 
getIntGets the value typed using the appropriate type conversion fromScalars.- Returns:
- value coerced to an integer, or NUMBER_DEFif coercion failed.
- Since:
- 4.0.0
- See Also:
 
- 
getIntGets the value typed using the appropriate type conversion fromScalars.- Parameters:
- def- the default value if no appropriate value is set
- Returns:
- value coerced to an integer, or defif coercion failed.
- Since:
- 4.0.0
- See Also:
 
- 
getLongGets the value typed using the appropriate type conversion fromScalars.- Returns:
- value coerced to a long, or NUMBER_DEFif coercion failed
- Since:
- 4.0.0
- See Also:
 
- 
getLongGets the value typed using the appropriate type conversion fromScalars.- Parameters:
- def- the default value if no appropriate value is set
- Returns:
- value coerced to a long, or defif coercion failed
- Since:
- 4.0.0
- See Also:
 
- 
getBooleanGets the value typed using the appropriate type conversion fromScalars.- Returns:
- value coerced to a boolean, or false if coercion failed
- Since:
- 4.0.0
- See Also:
 
- 
getBooleanGets the value typed using the appropriate type conversion fromScalars.- Parameters:
- def- the default value if no appropriate value is set
- Returns:
- value coerced to a boolean, or defif coercion failed
- Since:
- 4.0.0
- See Also:
 
- 
setSet this node's value to the given value.The value type will be taken from the provided value's class and used to determine a serializer. To set a value of a parameterized type, the parameters must be explicitly specified. - Parameters:
- value- the value to set
- Returns:
- this node
- Throws:
- SerializationException
- Since:
- 4.0.0
 
- 
set<V> ConfigurationNode set(io.leangen.geantyref.TypeToken<V> type, @Nullable V value) throws SerializationException Set this node's value to the given value.If the provided value is a Collectionor aMap, it will be unwrapped into the appropriate configuration node structure.This method will also perform serialization using the appropriate TypeSerializerfor the given type, or casting if no type serializer is found.- Type Parameters:
- V- the type to serialize to
- Parameters:
- type- the type to use for serialization type information
- value- the value to set
- Returns:
- this node
- Throws:
- SerializationException- if the value fails to be converted to the requested type. No change will be made to the node.
- Since:
- 4.0.0
 
- 
setSet this node's value to the given value.If the provided value is a Collectionor aMap, it will be unwrapped into the appropriate configuration node structure.This method will also perform serialization using the appropriate TypeSerializerfor the given type, or casting if no type serializer is found.This method will fail if a raw type (i.e. a parameterized type without its type parameters) is passed. - Type Parameters:
- V- the type to serialize to
- Parameters:
- type- the type to use for serialization type information
- value- the value to set
- Returns:
- this node
- Throws:
- IllegalArgumentException- if a raw type is passed
- SerializationException- if the value fails to be converted to the requested type. No change will be made to the node.
- Since:
- 4.0.0
 
- 
setSet this node's value to the given value.If the provided value is a Collectionor aMap, it will be unwrapped into the appropriate configuration node structure.This method will also perform serialization using the appropriate TypeSerializerfor the given type, or casting if no type serializer is found.This method will fail if a raw type (i.e. a parameterized type without its type parameters) is passed. Because this method accepts a non-parameterized Typeparameter, it has no compile-time type checking. The variants that takeTypeTokenandset(Class, Object)should be preferred where possible.- Parameters:
- type- the type to use for serialization type information
- value- the value to set
- Returns:
- this node
- Throws:
- IllegalArgumentException- if a raw type is passed
- IllegalArgumentException- if- valueis not either- nullor of type- type
- SerializationException- if the value fails to be converted to the requested type. No change will be made to the node.
- Since:
- 4.0.0
 
- 
setSet this node's value to the given value.If the provided value is a Collectionor aMap, it will be unwrapped into the appropriate configuration node structure.This method will also perform serialization using the appropriate TypeSerializerfor the given type, or casting if no type serializer is found.This method will fail if a raw type (i.e. a parameterized type without its type parameters) is passed. Because this method accepts a non-parameterized Typeparameter, it has no compile-time type checking. The variants that takeTypeTokenandset(Class, Object)should be preferred where possible.- Parameters:
- type- the annotated type to use for serialization type information
- value- the value to set
- Returns:
- this node
- Throws:
- IllegalArgumentException- if a raw type is passed
- IllegalArgumentException- if- valueis not either- nullor of type- type
- SerializationException- if the value fails to be converted to the requested type. No change will be made to the node.
- Since:
- 4.2.0
 
- 
setListdefault <V> ConfigurationNode setList(Class<V> elementType, @Nullable List<V> items) throws SerializationException Set the node's value to the provided list.This method provides a helper for constructing the appropriate Typefor serializing aList- Type Parameters:
- V- list element type, the- Tin- List<T>
- Parameters:
- elementType- the type of the list elements. This must not be a raw type.
- items- the list to serializer
- Returns:
- this node
- Throws:
- SerializationException- if the value fails to be converted to the requested type.
- Since:
- 4.0.0
- See Also:
 
- 
setListdefault <V> ConfigurationNode setList(io.leangen.geantyref.TypeToken<V> elementType, @Nullable List<V> items) throws SerializationException Set the node's value to the provided list.This method provides a helper for constructing the appropriate Typefor serializing aList- Type Parameters:
- V- list element type, the- Tin- List<T>
- Parameters:
- elementType- the type of the list elements. This must not be a raw type.
- items- the list to serializer
- Returns:
- this node
- Throws:
- SerializationException- if the value fails to be converted to the requested type.
- Since:
- 4.0.0
- See Also:
 
- 
rawGet the raw value of this node.The raw value is the plain value that will be passed to the loaders, without serialization except for unwrapping of maps and collections. - Returns:
- this configuration's current value
- Since:
- 4.0.0
- See Also:
 
- 
rawSet the raw value of this node.The provided value must be of a type accepted by ConfigurationOptions.acceptsType(Class). No other serialization will be performed.- Parameters:
- value- the value to set on this node
- Returns:
- this node
- Since:
- 4.0.0
 
- 
rawScalarGet the raw value of this node if the node is a scalar.The raw value is the plain value that will be passed to the loaders, without serialization. Map and list values will not be unboxed. - Returns:
- this configuration's current value if it is a scalar, or else null.
- Since:
- 4.0.0
- See Also:
 
- 
fromApply all data fromotherto this node, overwriting any existing data.- Parameters:
- other- source node
- Returns:
- this node
- Since:
- 4.0.0
 
- 
mergeFromSet all the values from the given node that are not present in this node to their values in the provided node.Map keys will be merged. Lists and scalar values will be replaced. - Parameters:
- other- the node to merge values from
- Returns:
- this node
- Since:
- 4.0.0
 
- 
removeChildRemoves a direct child of this node.- Parameters:
- key- the key of the node to remove
- Returns:
- if a node was removed
- Since:
- 4.0.0
 
- 
appendListNodeGets a new child node created as the next entry in the list.- Returns:
- a new child created as the next entry in the list when it is attached
- Since:
- 4.0.0
 
- 
copyCreates a deep copy of this node.If this node has child nodes (is a list or map), the child nodes will also be copied. This action is performed recursively. The resultant node will (initially) contain the same value(s) as this node, and will therefore be equal, however, changes made to the original will not be reflected in the copy, and vice versa.The actual scalar values that back the configuration will not be copied - only the node structure that forms the configuration. This is not a problem in most cases, as the scalar values stored in configurations are usually immutable. (e.g. strings, numbers, booleans). - Returns:
- a copy of this node
- Since:
- 4.0.0
 
- 
visitVisit this node hierarchy as described inConfigurationVisitor.- Type Parameters:
- S- the state type
- T- the terminal type
- E- exception type that may be thrown
- Parameters:
- visitor- the visitor
- Returns:
- returned terminal from the visitor
- Throws:
- E- when throw by visitor implementation
- Since:
- 4.0.0
 
- 
visitVisit this node hierarchy as described inConfigurationVisitor.- Type Parameters:
- T- the terminal type
- S- the state type
- E- exception type that may be thrown
- Parameters:
- visitor- the visitor
- state- the state to start with
- Returns:
- returned terminal from the visitor
- Throws:
- E- when throw by visitor implementation
- Since:
- 4.0.0
 
- 
visitVisit this node hierarchy as described inConfigurationVisitor.This overload will remove the need for exception handling for visitors that do not have any checked exceptions. - Type Parameters:
- S- the state type
- T- the terminal type
- Parameters:
- visitor- the visitor
- Returns:
- the returned terminal from the visitor
- Since:
- 4.0.0
 
- 
visitVisit this node hierarchy as described inConfigurationVisitor.This overload will remove the need for exception handling for visitors that do not have any checked exceptions. - Type Parameters:
- T- the terminal type
- S- the state type
- Parameters:
- visitor- the visitor
- state- the state to start with
- Returns:
- the returned terminal from the visitor
- Since:
- 4.0.0
 
- 
hintSet a representation hint on this node.Removing a hint from this node means the hint's value will be delegated to the node's parent. To explicitly revert to a hint's default, apply that default value. - Type Parameters:
- V- hint value type
- Parameters:
- hint- the hint to set a value for
- value- value to set, or null to unset for self
- Returns:
- this node
- Since:
- 4.0.0
 
- 
hintQuery a representation hint from this node.If the hint is not set on this node, its parents will be recursively checked for a value. - Type Parameters:
- V- value type
- Parameters:
- hint- the hint to get
- Returns:
- value of the hint, or RepresentationHint.defaultValue()
- Since:
- 4.0.0
 
- 
ownHintQuery a representation hint from this node.This will only check the current node, and return null rather than any default value. - Type Parameters:
- V- value type
- Parameters:
- hint- the hint to get
- Returns:
- value of the hint, or null
- Since:
- 4.0.0
 
- 
ownHintsMap<RepresentationHint<?>,?> ownHints()Get an unmodifiable copy of representation hints stored on this node.This does not include inherited hints. - Returns:
- copy of hints this node has set.
- Since:
- 4.0.0
 
 
-