Package org.skriptlang.skript.lang.entry
Class EntryData<T>
java.lang.Object
org.skriptlang.skript.lang.entry.EntryData<T>
- Type Parameters:
T
- The type of the value returned by this entry data.
- Direct Known Subclasses:
KeyValueEntryData
,SectionEntryData
,TriggerEntryData
EntryData is used for defining the different entries of for a
SectionNode
.
Structure
's are a primary user of this system.
Take a look at this example:
command /example: # this is the SectionNode description: this is an example of an entry trigger: # this is also an example of an entry # code goes here (not entry data!)From the above, it can be seen that EntryData is found at the level immediately after a
SectionNode
.
It can also be seen that entries come in many forms.
In fact, all entries are based upon a Node
.
This could be something like a SimpleNode
or SectionNode
,
but it may also be something totally different.
Every entry data class must define a validator-type method for Node
s, along with
a method of obtaining a value from that Node
.
Every entry data instance must contain some sort of key. This key is the main identifier
of an entry data instance within a EntryValidator
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
canCreateWith
(Node node) A method to be implemented by all entry data classes that determines whether the provided node may be used with the entry data type to obtain a value.getKey()
abstract T
Obtains a value from the provided node using the methods of this entry data.boolean
-
Constructor Details
-
EntryData
-
-
Method Details
-
getKey
- Returns:
- The key that identifies and defines this entry data.
-
getDefaultValue
- Returns:
- The default value of this entry node to be used if
getValue(Node)
is null, or if the user does not include an entry for this entry data within theirSectionNode
.
-
isOptional
public boolean isOptional()- Returns:
- Whether this entry data must be included within a
SectionNode
.
-
getValue
Obtains a value from the provided node using the methods of this entry data.- Parameters:
node
- The node to obtain a value from.- Returns:
- The value obtained from the provided node.
-
canCreateWith
A method to be implemented by all entry data classes that determines whether the provided node may be used with the entry data type to obtain a value.- Parameters:
node
- The node to check.- Returns:
- Whether the provided node may be used with this entry data to obtain a value.
-