|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.castor.xml.schema.ResolvableReference
public final class ResolvableReference
Implements a reference to an object that will be resolved at a later time using some resolver mechanism. A resolvable reference can be created in both resolved and unresolved states. Resolvable references are immutable by definition.
A resolverable reference has two states: resolved and unresolved. When in the resolved state, the reference will always return the same resolved object. When in the unresolved state, the first time the object is requested, it will be resolved and returned. At that point the reference becomes resolved and the same object is returned in subsequent requests.
The following example creates a resolved and unresolved objects and then resolved the two:
ResolvableReference resolved, unresolved; resolved = new ResolvableReference( myObject ); unresolved = new ResolvableReference( "id", resolver ); if ( resolved.get() == myObject ) ; // This will always be true if ( unresolved.get() == resolver.resolve( "id" ) ) ; // This will always be true
Resolver
Constructor Summary | |
---|---|
ResolvableReference(Referable referent)
Constructs a resolvable reference for the given object. |
|
ResolvableReference(java.lang.String id,
Resolver resolver)
Constructs a resolvable reference for the named object. |
Method Summary | |
---|---|
Referable |
get()
Called to resolve the object and return it. |
boolean |
resolvable()
Determines whether or not the reference can be resolved at the time this method is called. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResolvableReference(java.lang.String id, Resolver resolver)
get()
method is called.
id
- The object's identifierresolver
- The resolve to usepublic ResolvableReference(Referable referent)
referent
- The object to resolve toMethod Detail |
---|
public boolean resolvable()
public Referable get()
Null is returned if the object was resolved to null.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |