org.openrdf.model.impl
Class LiteralImpl

java.lang.Object
  extended byorg.openrdf.model.impl.LiteralImpl
All Implemented Interfaces:
Comparable, Literal, Serializable, Value

public class LiteralImpl
extends Object
implements Literal, Serializable

An implementation of the Literal interface.

See Also:
Serialized Form

Constructor Summary
LiteralImpl(String label)
          Creates a new Literal which will get the supplied label, but no language tag or datatype (=null).
LiteralImpl(String label, String language)
          Creates a new Literal which will get the supplied label and language tag.
LiteralImpl(String label, URI datatype)
          Creates a new Literal which will get the supplied label and datatype.
 
Method Summary
 int compareTo(Object o)
           
 boolean equals(Object o)
          Compares a literal object to another object.
 URI getDatatype()
          Gets the datatype for this literal.
 String getLabel()
          Gets the label of this literal.
 String getLanguage()
          Gets the language tag for this literal, normalized to lowercase.
 org.openrdf.sesame.sail.StatementIterator getObjectStatements()
          Gets all statements from the RDF graph for which this value is the object.
 int hashCode()
          The hash code of a literal is defined as the hash code of its label: label.hashCode().
 String toString()
          Returns the label of the literal.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LiteralImpl

public LiteralImpl(String label)
Creates a new Literal which will get the supplied label, but no language tag or datatype (=null).

Parameters:
label - The label for this literal.

LiteralImpl

public LiteralImpl(String label,
                   String language)
Creates a new Literal which will get the supplied label and language tag.

Parameters:
label - The label for this literal.
language - The language tag of the supplied label, or null if not specified.

LiteralImpl

public LiteralImpl(String label,
                   URI datatype)
Creates a new Literal which will get the supplied label and datatype.

Parameters:
label - The label for this literal.
datatype - The datatype of the supplied label, or null if not specified.
Method Detail

getLabel

public String getLabel()
Description copied from interface: Literal
Gets the label of this literal.

Specified by:
getLabel in interface Literal
Returns:
The literal's label.

getLanguage

public String getLanguage()
Description copied from interface: Literal
Gets the language tag for this literal, normalized to lowercase.

Specified by:
getLanguage in interface Literal
Returns:
The language tag for this literal, or null if it doesn't have one.

getDatatype

public URI getDatatype()
Description copied from interface: Literal
Gets the datatype for this literal.

Specified by:
getDatatype in interface Literal
Returns:
The datatype for this literal, or null if it doesn't have one.

equals

public boolean equals(Object o)
Description copied from interface: Literal
Compares a literal object to another object.

Specified by:
equals in interface Literal

hashCode

public int hashCode()
Description copied from interface: Literal
The hash code of a literal is defined as the hash code of its label: label.hashCode().

Specified by:
hashCode in interface Literal

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

toString

public String toString()
Returns the label of the literal.


getObjectStatements

public org.openrdf.sesame.sail.StatementIterator getObjectStatements()
                                                              throws GraphException
Description copied from interface: Value
Gets all statements from the RDF graph for which this value is the object.

Specified by:
getObjectStatements in interface Value
Throws:
GraphException


Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.