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
SimpleNodes containing a key and a value.
Unlike a traditional EntryNode, this entry data
may have a value that is not a String.-
Constructor Summary
ConstructorsConstructorDescriptionKeyValueEntryData(String key, T defaultValue, boolean optional) KeyValueEntryData(String key, T defaultValue, boolean optional, boolean multiple) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanCreateWith(Node node) Checks whether the provided node can have its value obtained using this entry data.final TUsed to obtain and parse the value of aSimpleNode.protected abstract TParses a String value using this entry data.Methods inherited from class org.skriptlang.skript.lang.entry.EntryData
getDefaultValue, getKey, isOptional, supportsMultiple
-
Constructor Details
-
KeyValueEntryData
-
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:
getValuein classEntryData<T>- Parameters:
node- ASimpleNodeto 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:
canCreateWithin classEntryData<T>- Parameters:
node- The node to check.- Returns:
- Whether the provided
Nodeworks with this entry data.
-