org.exolab.castor.xml.schema

Interface Resolver

public interface Resolver

Defines an object resolver but does not specify any implementation.

A lazy resolver would resolve an object given its identifier. The reference to the object will be created with a {@link ResolvableReference} object using the resolved and the identifier. When the object is requested, the {@link #resolve} method will be called to obtain it.

Some implementation will add and remove resolvable objects, e.g. a collection of objects that also acts as a resolver. These methods should implement {@link #addResolvable} and {@link #removeResolvable}. Resolvers that do not implement these methods are still considered valid resolvers. For example, a database based resolver will operate consistently without implementing add/remove not through the database interface.

Author: Assaf Arkin

See Also:

Method Summary
voidaddResolvable(String id, Referable referent)
Adds a resolvable object to this resolver identified by id.
voidremoveResolvable(String id)
Removes a resolvable object from this resolver.
Referableresolve(String id)
Called to resolve a reference give the reference's identifier.

Method Detail

addResolvable

public void addResolvable(String id, Referable referent)
Adds a resolvable object to this resolver identified by id. Subsequent calls to {@link #resolve} with the same id will return referent.

Parameters: id The referent's identifier referent The referent object

removeResolvable

public void removeResolvable(String id)
Removes a resolvable object from this resolver. Subsequent calls to {@link #resolve} with the same id will return null.

Parameters: id The referent's identifier

resolve

public Referable resolve(String id)
Called to resolve a reference give the reference's identifier. If the reference is known, this method should return the referenced object. If the reference is unknown, this method should return null.

Parameters: id The identifier to resolve

Returns: The resolved object

Intalio Inc. (C) 1999-2003. All rights reserved http://www.intalio.com