Package com.saicone.settings.node
Class NodeValue<V>
java.lang.Object
com.saicone.settings.node.NodeValue<V>
- Type Parameters:
V
- the value type of the node.
- All Implemented Interfaces:
SettingsNode
,com.saicone.types.AnyObject<Object>
- Direct Known Subclasses:
NodeKey
Abstract class that represents a node multi-layer value along with comments.
Any type transformation will be cached.
Any type transformation will be cached.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.saicone.types.AnyObject
com.saicone.types.AnyObject.Registry
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<E> E
<E> E
<E,
C extends Collection<E>>
CasCollection
(@NotNull com.saicone.types.TypeParser<E> parser, C collection) <E extends Enum<E>>
E<E extends Enum<E>>
EasOptional
(@NotNull com.saicone.types.TypeParser<E> parser) boolean
Get the facing value inside the node.Get side comment from the node.Get the value that will be used to save this node.Get top comment from the node.getValue()
int
hashCode()
boolean
Check if the current node has any side comment.boolean
Check if the current node has any top comment.static @NotNull SettingsNode
Create a node value with the given object.setSideComment
(@Nullable List<String> sideComment) Replace the node side comment.setSourceValue
(@Nullable Object value) Replace the actual source value.setTopComment
(@Nullable List<String> topComment) Replace the node top comment.Set the value that will be return onAnyObject.getValue()
and change this node instance depending on actual value.
If source value is not set will be replaced.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.saicone.types.AnyObject
as, as, asArray, asArray, asArray, asArray, asBigDecimal, asBigDecimal, asBigInteger, asBigInteger, asBoolean, asBoolean, asByte, asByte, asChar, asChar, asDouble, asDouble, asFloat, asFloat, asInt, asInt, asList, asLong, asLong, asMap, asMap, asNumber, asNumber, asSet, asShort, asShort, asString, asString, asUniqueId, asUniqueId
Methods inherited from interface com.saicone.settings.SettingsNode
addSideComment, addTopComment, asListNode, asLiteralObject, asMapNode, asObjectNode, copy, copy, copy, delete, delete, edit, edit, getKey, getParent, getRoot, isEmpty, isList, isMap, isObject, isReal, isRoot, merge, mergeComment, move, moveRoot, parse, parse, replaceArgs, replaceArgs, setKey, setParent
-
Constructor Details
-
NodeValue
Constructs a node value with the given object.- Parameters:
value
- the value of the node.
-
-
Method Details
-
of
Create a node value with the given object.- Parameters:
object
- the object to wrap as node value.- Returns:
- a settings node that represents the node value.
-
hasTopComment
public boolean hasTopComment()Description copied from interface:SettingsNode
Check if the current node has any top comment.- Specified by:
hasTopComment
in interfaceSettingsNode
- Returns:
- true if the node contains a top comment.
-
hasSideComment
public boolean hasSideComment()Description copied from interface:SettingsNode
Check if the current node has any side comment.- Specified by:
hasSideComment
in interfaceSettingsNode
- Returns:
- true if the node contains a side comment.
-
getValue
- Specified by:
getValue
in interfacecom.saicone.types.AnyObject<V>
-
getFaceValue
Get the facing value inside the node.- Returns:
- the value that was set after node creation, null otherwise.
-
getSourceValue
Description copied from interface:SettingsNode
Get the value that will be used to save this node.- Specified by:
getSourceValue
in interfaceSettingsNode
- Returns:
- a saved source value, null otherwise.
-
getTopComment
Description copied from interface:SettingsNode
Get top comment from the node.- Specified by:
getTopComment
in interfaceSettingsNode
- Returns:
- a comment if is set, null otherwise.
-
getSideComment
Description copied from interface:SettingsNode
Get side comment from the node.- Specified by:
getSideComment
in interfaceSettingsNode
- Returns:
- a comment if is set, null otherwise.
-
setValue
Description copied from interface:SettingsNode
Set the value that will be return onAnyObject.getValue()
and change this node instance depending on actual value.
If source value is not set will be replaced.- Specified by:
setValue
in interfaceSettingsNode
- Parameters:
value
- the value to set.- Returns:
- the effective node in this operation, normally this node.
-
setSourceValue
Description copied from interface:SettingsNode
Replace the actual source value.- Specified by:
setSourceValue
in interfaceSettingsNode
- Parameters:
value
- the source value to set.- Returns:
- the effective node in this operation, normally this node.
-
setTopComment
Description copied from interface:SettingsNode
Replace the node top comment.- Specified by:
setTopComment
in interfaceSettingsNode
- Parameters:
topComment
- the comment to set.- Returns:
- the effective node in this operation, normally this node.
-
setSideComment
Description copied from interface:SettingsNode
Replace the node side comment.- Specified by:
setSideComment
in interfaceSettingsNode
- Parameters:
sideComment
- the comment to set.- Returns:
- the effective node in this operation, normally this node.
-
as
- Specified by:
as
in interfacecom.saicone.types.AnyObject<V>
-
as
@Nullable public <E> E as(@NotNull @NotNull com.saicone.types.TypeParser<E> parser, @Nullable E def) - Specified by:
as
in interfacecom.saicone.types.AnyObject<V>
-
asOptional
@NotNull public <E> @NotNull Optional<E> asOptional(@NotNull @NotNull com.saicone.types.TypeParser<E> parser) - Specified by:
asOptional
in interfacecom.saicone.types.AnyObject<V>
-
asCollection
@NotNull public <E,C extends Collection<E>> C asCollection(@NotNull @NotNull com.saicone.types.TypeParser<E> parser, @NotNull C collection) - Specified by:
asCollection
in interfacecom.saicone.types.AnyObject<V>
-
asEnum
- Specified by:
asEnum
in interfacecom.saicone.types.AnyObject<V>
-
asEnum
- Specified by:
asEnum
in interfacecom.saicone.types.AnyObject<V>
-
toString
-
equals
-
hashCode
public int hashCode()
-