org.deegree.commons.tom
Class Reference<T extends Object>

java.lang.Object
  extended by org.deegree.commons.tom.Reference<T>
Type Parameters:
T - type of the referenced object
All Implemented Interfaces:
Object, TypedObjectNode
Direct Known Subclasses:
CRSResourceRef, GMLReference

public class Reference<T extends Object>
extends Object
implements Object

Represents a lazy reference to an Object.

Version:
$Revision: 29670 $, $Date: 2011-02-14 14:48:13 +0100 (Mon, 14 Feb 2011) $
Author:
Markus Schneider, last edited by: $Author: aschmitz $

Constructor Summary
Reference(ReferenceResolver resolver, String uri, String baseURL)
          Creates a new Reference instance.
 
Method Summary
 String getId()
          Returns the id of the object.
 T getReferencedObject()
          Returns the referenced Object instance (may trigger resolving and fetching it).
 String getURI()
          Returns the URI of the object.
 boolean isLocal()
           
 boolean isResolved()
          Returns whether the reference has been resolved.
 void resolve(T object)
          Sets the referenced object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Reference

public Reference(ReferenceResolver resolver,
                 String uri,
                 String baseURL)
Creates a new Reference instance.

Parameters:
resolver - used for resolving the reference, must not be null
uri - the object's uri, must not be null
baseURL - base URL for resolving the uri, may be null (no resolving of relative URLs)
Method Detail

getURI

public String getURI()
Returns the URI of the object.

Returns:
the URI of the object, never null

isResolved

public boolean isResolved()
Returns whether the reference has been resolved.

Returns:
true, if the reference has been resolved, false otherwise

isLocal

public boolean isLocal()

resolve

public void resolve(T object)
Sets the referenced object.

Parameters:
object - the referenced object, may be null

getReferencedObject

public T getReferencedObject()
                                     throws ReferenceResolvingException
Returns the referenced Object instance (may trigger resolving and fetching it).

Returns:
the referenced Object instance
Throws:
ReferenceResolvingException - if the reference cannot be resolved

getId

public String getId()
Description copied from interface: Object
Returns the id of the object.

Specified by:
getId in interface Object
Returns:
the id of the object, or null if it doesn't have an id


Copyright © 2011. All Rights Reserved.