|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This class enables one to store an entry in the defaults
table that isn't constructed until the first time it's
looked up with one of the getXXX(key)
methods.
Lazy values are useful for defaults that are expensive
to construct or are seldom retrieved. The first time
a LazyValue
is retrieved its "real value" is computed
by calling LazyValue.createValue()
and the real
value is used to replace the LazyValue
in the
UIDefaults
table. Subsequent lookups for the same key return
the real value. Here's an example of a LazyValue
that constructs a Border
:
Object borderLazyValue = new UIDefaults.LazyValue() { public Object createValue(UIDefaults table) { return new BorderFactory.createLoweredBevelBorder(); } }; uiDefaultsTable.put("MyBorder", borderLazyValue);
UIDefaults.get(java.lang.Object)
Method Summary | |
Object |
createValue(UIDefaults table)
Creates the actual value retrieved from the UIDefaults
table. |
Method Detail |
public Object createValue(UIDefaults table)
UIDefaults
table. When an object that implements this interface is
retrieved from the table, this method is used to create
the real value, which is then stored in the table and
returned to the calling method.table
- a UIDefaults
tableObject
|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.