Package org.skriptlang.skript.lang.entry
Class KeyValueEntryData<T>
java.lang.Object
org.skriptlang.skript.lang.entry.EntryData<T>
org.skriptlang.skript.lang.entry.KeyValueEntryData<T>
- Type Parameters:
T
- The type of the value.
- Direct Known Subclasses:
ExpressionEntryData
,LiteralEntryData
,VariableStringEntryData
An entry based on
SimpleNode
s containing a key and a value.
Unlike a traditional EntryNode
, this entry data
may have a value that is not a String.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canCreateWith
(Node node) Checks whether the provided node can have its value obtained using this entry data.final T
Used to obtain and parse the value of aSimpleNode
.protected abstract T
Parses a String value using this entry data.Methods inherited from class org.skriptlang.skript.lang.entry.EntryData
getDefaultValue, getKey, isOptional
-
Constructor Details
-
KeyValueEntryData
-
-
Method Details
-
getValue
Used to obtain and parse the value of aSimpleNode
. This method accepts any type of node, but assumes the input to be aSimpleNode
. Before calling this method, the caller should first checkcanCreateWith(Node)
to make sure that the node is viable.- Specified by:
getValue
in classEntryData<T>
- Parameters:
node
- ASimpleNode
to obtain (and possibly convert) the value of.- Returns:
- The value obtained from the provided
SimpleNode
.
-
getValue
Parses a String value using this entry data.- Parameters:
value
- The String value to parse.- Returns:
- The parsed value.
-
getSeparator
- Returns:
- The String acting as a separator between the key and the value.
-
canCreateWith
Checks whether the provided node can have its value obtained using this entry data. A check is done to verify that the node is aSimpleNode
, and that it starts with the necessary key.- Specified by:
canCreateWith
in classEntryData<T>
- Parameters:
node
- The node to check.- Returns:
- Whether the provided
Node
works with this entry data.
-