|
2004.04.29 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.jdc.util.Refresh
Refresh represents a utility class that determines when a
class containing data should be refreshed. A class containing data is usually,
but is not required to be a singleton. It is recommended that
a singleton class implement the Singleton interface.
Singleton interface, you may check if a class refresh is
required as in the following example:
if (Refresh.isRequired(Singleton)))
{
// Perform refresh.
}
No additional code is required in the class implementing the Singleton
interface. This class maintains the Refresh.Status for the specified
class to enable it to determine when a refresh is required.
Note: It is the responsibility of the class developer to ensure that the
specified class is properly implemented as a singleton. If it is not, this class
may produce undesirable results.
Or, you may declare an instance of Refresh.Status in your class and,
optionally, specify a refresh time and/or interval. If you choose to
maintain your own refresh Timestamp (and you must for classes
with multiple instances), you may check if a class refresh is required as in the
following example:
if (Refresh.isRequired(Refresh.Status)))
{
// Perform refresh.
}
Note: You may specify a class refresh time and/or refresh interval
when creating a new Refresh.Status instance using the
Refresh.Status(Object, Refresh.Time, Refresh.Interval) constructor.
It is important to note that this class is an implementation of a lazy
refresh, i.e. a refresh of a specified class instance will not occur
until the class instance invokes one of the Refresh.isRequired
methods and a result of true is returned. Therefore, it is
likely that an invoking class instance will not be refreshed precisely
at the requested refresh time and/or interval or, perhaps, not at all if
the invoking class is never instantiated.
Refresh.Status,
Singleton| Nested Class Summary | |
protected class |
Refresh.Interval
Interval represents an interval or the amount of time between
refreshes of a specified class instance. |
class |
Refresh.Status
Status represents a Timestamp denoting the
last refresh time for a specified class instance. |
protected class |
Refresh.Time
Time represents the time of day a refresh of a specified class
instance should occur. |
protected class |
Refresh.Timestamp
Interval represents an interval or the amount of time between
refreshes of a specified class instance. |
| Method Summary | |
static void |
all()
Initializes the last refresh time for all registered classes in order to force a refresh on the next class access. |
static void |
initialize(String className)
Initializes the last refresh time for the specified singleton class instance given a fully-qualified class name in order to force a refresh on the next class access. |
static boolean |
isRequired(Object object)
Returns true if a refresh is required for the specified
Object class instance. |
static boolean |
isRequired(Refresh.Status lastRefresh)
Returns true if a refresh is required given the last
Refresh.Status. |
static Iterator |
iterator()
Returns an Iterator for all registered refresh class
instances. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static void all()
public static void initialize(String className)
public static boolean isRequired(Refresh.Status lastRefresh)
true if a refresh is required given the last
Refresh.Status.
True if a refresh is required. False if a refresh is not required.public static boolean isRequired(Object object)
true if a refresh is required for the specified
Object class instance.
True if a refresh is required. False if a refresh is not required.public static Iterator iterator()
Iterator for all registered refresh class
instances.
Iterator for all registered refresh class instances.
|
2004.04.29 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||