public static class PersistentContext.Reference<T> extends Object implements Reference<T>
This class represents a reference over an object which can be kept
persistent accross multiple program executions. Instances of this class
are typically used to hold global data time consuming to regenerate.
For example:[code]
public class FastMap
Persistent references may also be used to hold optimum configuration
values set from previous executions. For example:[code]
public Targets {
private static PersistentContext.Reference
Constructor and Description |
---|
PersistentContext.Reference(String id,
T defaultValue)
Creates a persistent reference identified by the specified name and
having the specified default value.
|
Modifier and Type | Method and Description |
---|---|
T |
get()
Returns the value this reference referes to.
|
protected void |
notifyChange()
Notifies this reference that its value has changed (for example
a new persistent context has been loaded).
|
void |
set(T value)
Sets the value this reference referes to.
|
void |
setMaximum(T value)
Sets this reference to the specified value only if
(value.compareTo(this.get()) < 0) . |
void |
setMinimum(T value)
Sets this reference to the specified value only if
(value.compareTo(this.get()) > 0) . |
String |
toString()
Returns the string representation of the current value of this
reference.
|
public PersistentContext.Reference(String id, T defaultValue)
id
- the unique identifier.defaultValue
- the default value.IllegalArgumentException
- if the name is not unique.public T get()
Reference
public void set(T value)
Reference
public void setMinimum(T value)
(value.compareTo(this.get()) > 0)
.value
- the minimum value for this reference.IllegalArgumentException
- if the specified value is not
Comparable
or an Integer
instance (J2ME).public void setMaximum(T value)
(value.compareTo(this.get()) < 0)
.value
- the maximum value for this reference.IllegalArgumentException
- if the specified value is not
Comparable
or an Integer
instance (J2ME).public String toString()
protected void notifyChange()
Copyright © 2005–2013 Javolution. All rights reserved.