public static class PersistentContext.Reference extends Object implements Reference
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 |
|---|
Reference(String id,
Object defaultValue)
Creates a persistent reference identified by the specified name and
having the specified default value.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
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(Object value)
Sets the value this reference referes to.
|
void |
setMaximum(Object value)
Sets this reference to the specified value only if
(value.compareTo(this.get()) < 0). |
void |
setMinimum(Object 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 Reference(String id, Object defaultValue)
id - the unique identifier.defaultValue - the default value.IllegalArgumentException - if the name is not unique.public Object get()
Referencepublic void set(Object value)
Referencepublic void setMinimum(Object 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(Object 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–2024 Javolution. All rights reserved.