Class Bindings

java.lang.Object
org.oristool.lello.Bindings

public class Bindings extends Object
A collection of pairs name/value, also called bindings. This can be seen as a set of variables each bound to a given value.
  • Field Details

    • NOBINDINGS

      public static final Bindings NOBINDINGS
      A predefined empty set of bindings; use this instead of null when you do not want to bind any name. This collection is read-only.
  • Constructor Details

    • Bindings

      public Bindings()
      Initializes an empty set of bindings.
  • Method Details

    • set

      public void set(String name, Value value)
      Assigns a value to a variable.
      Parameters:
      name - The name of the variable to set.
      value - The new value.
    • get

      public Value get(String name)
      Retrieves a value.
      Parameters:
      name - The name of the variable whose value must be retrieved.
      Returns:
      The associated value.
    • unset

      public void unset(String name)
      Destroys a variable.
      Parameters:
      name - The name of the variable to be destroyed.
    • isBound

      public boolean isBound(String name)
      Tells if a given variable is bound to a value or not.
      Parameters:
      name - The name of the variable to be tested.
      Returns:
      true if bound, false otherwise.
    • mapValues

      public Map<String,Value> mapValues()
      Retrieves all the name/value mappings.
      Returns:
      A map describing all the bindings.