Class EntryData<T>

Type Parameters:
T - The type of the value returned by this entry data.
Direct Known Subclasses:
KeyValueEntryData, SectionEntryData, TriggerEntryData

public abstract class EntryData<T> extends Object
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 Nodes, 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 Details

    • EntryData

      public EntryData(String key, @Nullable T defaultValue, boolean optional)
  • Method Details

    • getKey

      public String getKey()
      The key that identifies and defines this entry data.
    • getDefaultValue

      public @Nullable T getDefaultValue()
      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 their SectionNode.
    • isOptional

      public boolean isOptional()
      Whether this entry data must be included within a SectionNode.
    • getValue

      public abstract @Nullable T getValue(Node node)
      Obtains a value from the provided node using the methods of this entry data.
      node - The node to obtain a value from.
      The value obtained from the provided node.
    • canCreateWith

      public abstract 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.
      node - The node to check.
      Whether the provided node may be used with this entry data to obtain a value.