public class SimpleLiteral extends Object implements Literal
Literal
interface.Modifier | Constructor and Description |
---|---|
protected |
SimpleLiteral() |
protected |
SimpleLiteral(String label)
Creates a new plain literal with the supplied label.
|
protected |
SimpleLiteral(String label,
IRI datatype)
Creates a new datyped literal with the supplied label and datatype.
|
protected |
SimpleLiteral(String label,
String language)
Creates a new plain literal with the supplied label and language tag.
|
Modifier and Type | Method and Description |
---|---|
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 o)
Compares a literal object to another object.
|
float |
floatValue()
Returns the float value of this literal.
|
IRI |
getDatatype()
Gets the datatype for this literal.
|
String |
getLabel()
Gets the label (the lexical value) of this literal.
|
Optional<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.
|
protected void |
setDatatype(IRI datatype) |
protected void |
setLabel(String label) |
protected void |
setLanguage(String language) |
short |
shortValue()
Returns the short value of this literal.
|
String |
stringValue()
Returns the String-value of a Value object.
|
String |
toString()
Returns the label of the literal with its language or datatype.
|
protected SimpleLiteral()
protected SimpleLiteral(String label)
label
- The label for the literal, must not be null.protected SimpleLiteral(String label, String language)
label
- The label for the literal, must not be null.language
- The language tag for the literal, must not be null and not be empty.protected void setLabel(String label)
public String getLabel()
Literal
protected void setLanguage(String language)
public Optional<String> getLanguage()
Literal
getLanguage
in interface Literal
Optional.empty()
if it doesn't have one.protected void setDatatype(IRI datatype)
public IRI getDatatype()
Literal
Literal.getLanguage()
returns a non-empty value than this must return
RDF.LANGSTRING
. If no datatype was assigned to this literal by the creator, then this method must return
XMLSchema.STRING
.getDatatype
in interface Literal
public boolean equals(Object o)
Literal
public int hashCode()
Literal
public String toString()
toString
in class Object
NTriplesUtil.toNTriplesString(Literal)
public String stringValue()
Value
Literal
's label, a
IRI
's URI or a BNode
's ID.stringValue
in interface Value
public boolean booleanValue()
Literal
booleanValue
in interface Literal
public byte byteValue()
Literal
public short shortValue()
Literal
shortValue
in interface Literal
public int intValue()
Literal
public long longValue()
Literal
public float floatValue()
Literal
floatValue
in interface Literal
public double doubleValue()
Literal
doubleValue
in interface Literal
public BigInteger integerValue()
Literal
integerValue
in interface Literal
public BigDecimal decimalValue()
Literal
decimalValue
in interface Literal
public XMLGregorianCalendar calendarValue()
Literal
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.calendarValue
in interface Literal
Copyright © 2015-2019 Eclipse Foundation. All Rights Reserved.