Package gnu.mapping
Class DynamicLocation<T>
- java.lang.Object
-
- gnu.mapping.Location<T>
-
- gnu.mapping.IndirectableLocation<T>
-
- gnu.mapping.NamedLocation<T>
-
- gnu.mapping.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.
-
-
Field Summary
-
Fields inherited from class gnu.mapping.IndirectableLocation
base, DIRECT_ON_SET, INDIRECT_FLUIDS, value
-
Fields inherited from interface gnu.mapping.EnvironmentKey
FUNCTION
-
-
Constructor Summary
Constructors Constructor Description DynamicLocation(Symbol name, Object property)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Tget()Get the current value of this location.Tget(T defaultValue)static DynamicLocationgetInstance(Symbol name, Object property)For a given (Symbol.NamedLocation<T>getLocation()Get the thread-specific Location for this Location.StringgetName()ObjectgetSymbol()booleanisBound()voidset(T value)voidsetName(String name)voidsetRestore(Object oldValue)Restore an old value.ObjectsetWithSave(T newValue)Set a value, but return cookie so old value can be restored.voidundefine()-
Methods inherited from class gnu.mapping.NamedLocation
entered, equals, getEnvironment, getKey, getKeyProperty, getKeySymbol, hashCode, matches, matches
-
Methods inherited from class gnu.mapping.IndirectableLocation
getBase, getBaseForce, isConstant, setAlias, setBase
-
Methods inherited from class gnu.mapping.Location
define, getValue, make, make, make, print, setValue, toString
-
-
-
-
Method Detail
-
getLocation
public NamedLocation<T> getLocation()
Get the thread-specific Location for this Location.
-
setWithSave
public Object setWithSave(T newValue)
Description copied from class:LocationSet 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:
setWithSavein classNamedLocation<T>
-
setRestore
public void setRestore(Object oldValue)
Description copied from class:LocationRestore an old value.- Overrides:
setRestorein classNamedLocation<T>- Parameters:
oldValue- the return value from a prior setWithSave.
-
undefine
public void undefine()
- Overrides:
undefinein classIndirectableLocation<T>
-
getInstance
public static DynamicLocation getInstance(Symbol name, Object property)
For a given (Symbol. property)-pair, find or create a matching DynamicLocation.
-
-