public static class LocalContext.Reference<T> extends java.lang.Object implements Reference<T>
This class represents a reference whose setting is local to the current
LocalContext
. Setting outside of any LocalContext
scope
affects the reference default value (equivalent to setDefault(T)
).
Constructor and Description |
---|
Reference()
Default constructor (default referent is
null ). |
Reference(T defaultValue)
Creates a local reference having the specified default value.
|
Modifier and Type | Method and Description |
---|---|
T |
get()
Returns the local value for this reference.
|
T |
getDefault()
Returns the default value for this reference.
|
T |
getLocal()
Returns the local (non-inherited) value for this reference.
|
void |
set(T value)
Sets the local value (referent) for this reference.
|
void |
setDefault(T defaultValue)
Sets the default value for this reference.
|
java.lang.String |
toString()
Returns the string representation of the current value of this
reference.
|
public Reference()
null
).public Reference(T defaultValue)
defaultValue
- the default value or root value of this variable.public final T get()
LocalContext
is searched first, then
all outer LocalContext
are recursively searched up to the
global root context which contains the default value.public void set(T value)
public T getDefault()
public T getLocal()
null
if none (value to be
inherited or not set).public void setDefault(T defaultValue)
defaultValue
- the root value.public java.lang.String toString()
toString
in class java.lang.Object
String.valueOf(this.get())
Copyright © 2005 - 2007 Javolution.