com.hp.hpl.mesa.rdf.jena.common
Class LiteralImpl

java.lang.Object
  |
  +--com.hp.hpl.mesa.rdf.jena.common.LiteralImpl
All Implemented Interfaces:
Literal, RDFNode

public class LiteralImpl
extends java.lang.Object
implements Literal

An implementation of Literal.

Version:
Release='$Name: $' Revision='$Revision: 1.3 $' Date='$Date: 2001/07/04 17:53:58 $'
Author:
bwm

Constructor Summary
LiteralImpl(boolean b)
           
LiteralImpl(char c)
           
LiteralImpl(double d)
           
LiteralImpl(float f)
           
LiteralImpl(long l)
           
LiteralImpl(java.lang.Object o)
           
LiteralImpl(java.lang.String s)
           
LiteralImpl(java.lang.String s, boolean wellFormed)
           
LiteralImpl(java.lang.String s, java.lang.String l)
           
LiteralImpl(java.lang.String s, java.lang.String l, boolean wellFormed)
           
 
Method Summary
 boolean equals(java.lang.Object o)
          Test whether another object is equal to this object.
 boolean getBoolean()
          Interpret the literal as a String representation of a Boolean and return its value.
 byte getByte()
          Interpret the literal as a String representation of a byte and return its value.
 char getChar()
          Interpret the literal as a String representation of a char and return its value.
 double getDouble()
          Interpret the literal as a String representation of a double and return its value.
 float getFloat()
          Interpret the literal as a String representation of a float and return its value.
 int getInt()
          Interpret the literal as a String representation of an int and return its value.
 java.lang.String getLanguage()
          If a language is defined for this literal return it
 long getLong()
          Interpret the literal as a String representation of a long and return its value.
 java.lang.Object getObject(ObjectF f)
          Interpret the literal as a String representation of an object.
 short getShort()
          Interpret the literal as a String representation of a short and return its value.
 java.lang.String getString()
          Return the String value of the literal
 boolean getWellFormed()
          Return whether Literal is well formed XML
 int hashCode()
           
 java.lang.String toString()
          Return a String representation of the node.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LiteralImpl

public LiteralImpl(boolean b)

LiteralImpl

public LiteralImpl(long l)

LiteralImpl

public LiteralImpl(char c)

LiteralImpl

public LiteralImpl(float f)

LiteralImpl

public LiteralImpl(double d)

LiteralImpl

public LiteralImpl(java.lang.String s)

LiteralImpl

public LiteralImpl(java.lang.String s,
                   java.lang.String l)

LiteralImpl

public LiteralImpl(java.lang.String s,
                   boolean wellFormed)

LiteralImpl

public LiteralImpl(java.lang.String s,
                   java.lang.String l,
                   boolean wellFormed)

LiteralImpl

public LiteralImpl(java.lang.Object o)
Method Detail

toString

public java.lang.String toString()
Description copied from interface: RDFNode
Return a String representation of the node. The form of the string depends on the type of the node.
Specified by:
toString in interface RDFNode
Overrides:
toString in class java.lang.Object
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.RDFNode
Returns:
a String representation of this object.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Description copied from interface: Literal
Test whether another object is equal to this object.

A Literal is equal to another object only if the object is also a Literal and the string value and language of both literals are equal.

Specified by:
equals in interface Literal
Overrides:
equals in class java.lang.Object
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Literal
Parameters:
o - The object to test against
Returns:
true if the the objects are equal, false otherwise

getBoolean

public boolean getBoolean()
                   throws RDFException
Description copied from interface: Literal
Interpret the literal as a String representation of a Boolean and return its value.
Specified by:
getBoolean in interface Literal
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Literal
Returns:
the literal interpeted as a boolean
Throws:
RDFException - Generic RDF Exception

getByte

public byte getByte()
             throws RDFException
Description copied from interface: Literal
Interpret the literal as a String representation of a byte and return its value.
Specified by:
getByte in interface Literal
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Literal
Returns:
the literal interpeted as a byte
Throws:
RDFException - Generic RDF Exception

getShort

public short getShort()
               throws RDFException
Description copied from interface: Literal
Interpret the literal as a String representation of a short and return its value.
Specified by:
getShort in interface Literal
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Literal
Returns:
the literal interpeted as a short
Throws:
RDFException - Generic RDF Exception

getInt

public int getInt()
           throws RDFException
Description copied from interface: Literal
Interpret the literal as a String representation of an int and return its value.
Specified by:
getInt in interface Literal
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Literal
Returns:
the literal interpeted as an int
Throws:
RDFException - Generic RDF Exception

getLong

public long getLong()
             throws RDFException
Description copied from interface: Literal
Interpret the literal as a String representation of a long and return its value.
Specified by:
getLong in interface Literal
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Literal
Returns:
the literal interpeted as a long
Throws:
RDFException - Generic RDF Exception

getChar

public char getChar()
             throws RDFException
Description copied from interface: Literal
Interpret the literal as a String representation of a char and return its value.
Specified by:
getChar in interface Literal
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Literal
Returns:
the literal interpeted as a char
Throws:
RDFException - Generic RDF Exception

getFloat

public float getFloat()
               throws RDFException
Description copied from interface: Literal
Interpret the literal as a String representation of a float and return its value.
Specified by:
getFloat in interface Literal
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Literal
Returns:
the literal interpeted as a float
Throws:
RDFException - Generic RDF Exception

getDouble

public double getDouble()
                 throws RDFException
Description copied from interface: Literal
Interpret the literal as a String representation of a double and return its value.
Specified by:
getDouble in interface Literal
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Literal
Returns:
the literal interpeted as a double
Throws:
RDFException - Generic RDF Exception

getString

public java.lang.String getString()
                           throws RDFException
Description copied from interface: Literal
Return the String value of the literal
Specified by:
getString in interface Literal
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Literal
Returns:
the literal string
Throws:
RDFException - Generic RDF Exception

getObject

public java.lang.Object getObject(ObjectF f)
                           throws RDFException
Description copied from interface: Literal
Interpret the literal as a String representation of an object.
Specified by:
getObject in interface Literal
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Literal
Parameters:
f - A factory object for creating the returned object.
Returns:
the object created from the literal string
Throws:
RDFException - Generic RDF Exception

getLanguage

public java.lang.String getLanguage()
Description copied from interface: Literal
If a language is defined for this literal return it
Specified by:
getLanguage in interface Literal
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Literal
Returns:
the language for this literal if it exists, or null

getWellFormed

public boolean getWellFormed()
Description copied from interface: Literal
Return whether Literal is well formed XML
Specified by:
getWellFormed in interface Literal
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Literal
Returns:
true if the literal is well formed XML, e.g. as would be produced from a parseType="Literal" element.


Copyright © 2001 Hewlett-Packard. All Rights Reserved.