org.jrdf.graph
Class AbstractURIReference

java.lang.Object
  extended by org.jrdf.graph.AbstractURIReference
All Implemented Interfaces:
Serializable, Node, ObjectNode, PredicateNode, SubjectNode, TypedNodeVisitable, URIReference
Direct Known Subclasses:
URIReferenceImpl, URIReferenceImpl

public abstract class AbstractURIReference
extends Object
implements URIReference, Serializable

A base implementation of an RDF URIReference.

Version:
$Revision: 1822 $
Author:
Simon Raboczi, Andrew Newman
See Also:
Serialized Form

Field Summary
protected  URI uri
          The URI of the node.
 
Constructor Summary
protected AbstractURIReference()
           
protected AbstractURIReference(URI newUri)
          Constructor.
protected AbstractURIReference(URI newUri, boolean validate)
          Constructor.
 
Method Summary
 void accept(TypedNodeVisitor visitor)
          Accept a call from a TypedNodeVisitor.
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 URI getURI()
          The URI identifiying this resource.
 int hashCode()
          Returns a hash-code value for this URI Reference.
 String toString()
          Provide a legible representation of a URI reference.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

uri

protected URI uri
The URI of the node.

Constructor Detail

AbstractURIReference

protected AbstractURIReference()

AbstractURIReference

protected AbstractURIReference(URI newUri)
                        throws IllegalArgumentException
Constructor.

Enforces a non-null and absolute newUri parameter.

Parameters:
newUri - the URI to use in creation.
Throws:
IllegalArgumentException - if newUri is null or not absolute

AbstractURIReference

protected AbstractURIReference(URI newUri,
                               boolean validate)
                        throws IllegalArgumentException
Constructor.

Enforces a non-null parameter. Use only for applications where enforcement of valid URIs is too expensive or not necessary.

Parameters:
newUri - the URI to use in creation.
validate - whether to enforce valid RDF URIs.
Throws:
IllegalArgumentException - if newUri is not absolute and validate is true.
Method Detail

getURI

public URI getURI()
The URI identifiying this resource.

Specified by:
getURI in interface URIReference
Returns:
the URI identifying this resource.

accept

public void accept(TypedNodeVisitor visitor)
Accept a call from a TypedNodeVisitor.

Specified by:
accept in interface TypedNodeVisitable
Parameters:
visitor - the object doing the visiting.

hashCode

public int hashCode()
Description copied from interface: URIReference
Returns a hash-code value for this URI Reference. This is the hash code of the URI.

Specified by:
hashCode in interface URIReference
Overrides:
hashCode in class Object
Returns:
a hash-code value for this literal.

toString

public String toString()
Provide a legible representation of a URI reference. Currently, just the URI of the reference.

Overrides:
toString in class Object
Returns:
the uri property called toString() on.

equals

public boolean equals(Object obj)
Description copied from interface: URIReference
Indicates whether some other object is "equal to" this one.

A URI Reference is equal to another URI Reference if their URIs are equal to one another, character by character.

Specified by:
equals in interface URIReference
Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.