Class VariableDefinition<T>

java.lang.Object
io.github.mmm.base.variable.VariableDefinition<T>
Type Parameters:
T - type of the value for this option. See getType().

public class VariableDefinition<T> extends Object
Definition of a variable for a VariableMap. It is a simple container for the name of the variable with its getDefaultValue() and its type making the access of the value type-safe.
Since:
1.0.0
  • Constructor Details

    • VariableDefinition

      public VariableDefinition(String name, Class<T> type)
      The constructor.
      Parameters:
      name - the name.
      type - the type.
    • VariableDefinition

      public VariableDefinition(String name, T defaultValue)
      The constructor.
      Parameters:
      name - the name.
      defaultValue - the default value.
    • VariableDefinition

      public VariableDefinition(String name, Class<T> type, T defaultValue)
      The constructor.
      Parameters:
      name - the name.
      type - the type.
      defaultValue - the default value.
  • Method Details

    • getName

      public String getName()
      Returns:
      the name of the variable used as key to get its value.
    • getType

      public Class<T> getType()
      Returns:
      the Class reflecting the value of this variable.
    • getDefaultValue

      public T getDefaultValue()
      Returns:
      the optional default value to use if the variable is not explicitly defined.
    • toString

      public String toString()
      Overrides:
      toString in class Object