public final class ResolvableReference
extends java.lang.Object
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 | Description |
---|---|
ResolvableReference(java.lang.String id,
Resolver resolver) |
Constructs a resolvable reference for the named object.
|
ResolvableReference(Referable referent) |
Constructs a resolvable reference for the given object.
|
Modifier and Type | Method | Description |
---|---|---|
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.
|
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 topublic boolean resolvable()
public Referable get()
Null is returned if the object was resolved to null.
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com