Package gnu.mapping

Class DynamicLocation<T>

All Implemented Interfaces:
EnvironmentKey, Named, Map.Entry<EnvironmentKey,T>

public class DynamicLocation<T> extends NamedLocation<T> implements Named
A Location that forwards to a thread-specific Location.
  • Constructor Details

    • DynamicLocation

      public DynamicLocation(Symbol name, Object property)
  • Method Details

    • getLocation

      public NamedLocation<T> getLocation()
      Get the thread-specific Location for this Location.
    • get

      public T get()
      Description copied from class: Location
      Get the current value of this location.
      Specified by:
      get in class Location<T>
    • get

      public T get(T defaultValue)
      Overrides:
      get in class Location<T>
    • isBound

      public boolean isBound()
      Specified by:
      isBound in class Location<T>
    • set

      public void set(T value)
      Specified by:
      set in class Location<T>
    • setWithSave

      public Object setWithSave(T newValue)
      Description copied from class: Location
      Set a value, but return cookie so old value can be restored. This is intended for fluid-let where (in the case of multiple threads) a simple save-restore isn't always the right thing.
      Overrides:
      setWithSave in class NamedLocation<T>
    • setRestore

      public void setRestore(Object oldValue)
      Description copied from class: Location
      Restore an old value.
      Overrides:
      setRestore in class NamedLocation<T>
      Parameters:
      oldValue - the return value from a prior setWithSave.
    • undefine

      public void undefine()
      Overrides:
      undefine in class IndirectableLocation<T>
    • getName

      public String getName()
      Specified by:
      getName in interface Named
    • getSymbol

      public Object getSymbol()
      Specified by:
      getSymbol in interface Named
    • setName

      public void setName(String name)
      Specified by:
      setName in interface Named
    • getInstance

      public static DynamicLocation getInstance(Symbol name, Object property)
      For a given (Symbol. property)-pair, find or create a matching DynamicLocation.