org.openrdf.model
Interface Literal

All Superinterfaces:
Serializable, Value
All Known Implementing Classes:
BooleanLiteralImpl, BooleanMemLiteral, CalendarLiteralImpl, CalendarMemLiteral, DecimalLiteralImpl, DecimalMemLiteral, IntegerLiteralImpl, IntegerMemLiteral, LiteralImpl, MemLiteral, NativeLiteral, NumericLiteralImpl, NumericMemLiteral

public interface Literal
extends Value

An RDF literal consisting of a label (the value) and optionally a language tag or a datatype (but not both).

Author:
Arjohn Kampman

Method Summary
 boolean booleanValue()
          Returns the boolean value of this literal.
 byte byteValue()
          Returns the byte value of this literal.
 XMLGregorianCalendar calendarValue()
          Returns the XMLGregorianCalendar value of this literal.
 BigDecimal decimalValue()
          Returns the decimal value of this literal.
 double doubleValue()
          Returns the double value of this literal.
 boolean equals(Object other)
          Compares a literal object to another object.
 float floatValue()
          Returns the float value of this literal.
 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 lower case.
 int hashCode()
          Returns the literal's hash code.
 BigInteger integerValue()
          Returns the integer value of this literal.
 int intValue()
          Returns the int value of this literal.
 long longValue()
          Returns the long value of this literal.
 short shortValue()
          Returns the short value of this literal.
 
Methods inherited from interface org.openrdf.model.Value
stringValue
 

Method Detail

getLabel

String getLabel()
Gets the label of this literal.

Returns:
The literal's label.

getLanguage

String getLanguage()
Gets the language tag for this literal, normalized to lower case.

Returns:
The language tag for this literal, or null if it doesn't have one.

getDatatype

URI getDatatype()
Gets the datatype for this literal.

Returns:
The datatype for this literal, or null if it doesn't have one.

equals

boolean equals(Object other)
Compares a literal object to another object.

Overrides:
equals in class Object
Parameters:
other - The object to compare this literal to.
Returns:
true if the other object is an instance of Literal and if their labels, language tags and datatypes are equal.

hashCode

int hashCode()
Returns the literal's hash code. The hash code of a literal is defined as the hash code of its label: label.hashCode().

Overrides:
hashCode in class Object
Returns:
A hash code for the literal.

byteValue

byte byteValue()
Returns the byte value of this literal.

Returns:
The byte value of the literal.
Throws:
NumberFormatException - If the literal cannot be represented by a byte.

shortValue

short shortValue()
Returns the short value of this literal.

Returns:
The short value of the literal.
Throws:
NumberFormatException - If the literal's label cannot be represented by a short.

intValue

int intValue()
Returns the int value of this literal.

Returns:
The int value of the literal.
Throws:
NumberFormatException - If the literal's label cannot be represented by a int.

longValue

long longValue()
Returns the long value of this literal.

Returns:
The long value of the literal.
Throws:
NumberFormatException - If the literal's label cannot be represented by to a long.

integerValue

BigInteger integerValue()
Returns the integer value of this literal.

Returns:
The integer value of the literal.
Throws:
NumberFormatException - If the literal's label is not a valid integer.

decimalValue

BigDecimal decimalValue()
Returns the decimal value of this literal.

Returns:
The decimal value of the literal.
Throws:
NumberFormatException - If the literal's label is not a valid decimal.

floatValue

float floatValue()
Returns the float value of this literal.

Returns:
The float value of the literal.
Throws:
NumberFormatException - If the literal's label cannot be represented by a float.

doubleValue

double doubleValue()
Returns the double value of this literal.

Returns:
The double value of the literal.
Throws:
NumberFormatException - If the literal's label cannot be represented by a double.

booleanValue

boolean booleanValue()
Returns the boolean value of this literal.

Returns:
The long value of the literal.
Throws:
IllegalArgumentException - If the literal's label cannot be represented by a boolean.

calendarValue

XMLGregorianCalendar calendarValue()
Returns the XMLGregorianCalendar value of this literal. A calendar representation can be given for literals whose label conforms to the syntax of the following XML Schema datatypes: dateTime, time, date, gYearMonth, gMonthDay, gYear, gMonth or gDay.

Returns:
The calendar value of the literal.
Throws:
IllegalArgumentException - If the literal cannot be represented by a XMLGregorianCalendar.


Copyright © 2001-2008 Aduna. All Rights Reserved.