Class KeyValueEntryData<T>

Type Parameters:
T - The type of the value.
Direct Known Subclasses:
ExpressionEntryData, LiteralEntryData, VariableStringEntryData

public abstract class KeyValueEntryData<T> extends EntryData<T>
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 Details

    • KeyValueEntryData

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

    • getValue

      public final @Nullable T getValue(Node node)
      Used to obtain and parse the value of a SimpleNode. This method accepts any type of node, but assumes the input to be a SimpleNode. Before calling this method, the caller should first check canCreateWith(Node) to make sure that the node is viable.
      Specified by:
      getValue in class EntryData<T>
      node - A SimpleNode to obtain (and possibly convert) the value of.
      The value obtained from the provided SimpleNode.
    • getValue

      protected abstract @Nullable T getValue(String value)
      Parses a String value using this entry data.
      value - The String value to parse.
      The parsed value.
    • getSeparator

      public String getSeparator()
      The String acting as a separator between the key and the value.
    • canCreateWith

      public boolean canCreateWith(Node node)
      Checks whether the provided node can have its value obtained using this entry data. A check is done to verify that the node is a SimpleNode, and that it starts with the necessary key.
      Specified by:
      canCreateWith in class EntryData<T>
      node - The node to check.
      Whether the provided Node works with this entry data.