Package org.eclipse.rdf4j.model.impl
Class SimpleLiteral
- java.lang.Object
-
- org.eclipse.rdf4j.model.base.AbstractLiteral
-
- org.eclipse.rdf4j.model.impl.SimpleLiteral
-
- All Implemented Interfaces:
Serializable,Literal,Value
- Direct Known Subclasses:
BooleanLiteral,CalendarLiteral,DecimalLiteral,IntegerLiteral
public class SimpleLiteral extends AbstractLiteral
A simple default implementation of theLiteralinterface.- Author:
- Arjohn Kampman, David Huynh
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSimpleLiteral()protectedSimpleLiteral(String label)Creates a new plain literal with the supplied label.protectedSimpleLiteral(String label, String language)Creates a new plain literal with the supplied label and language tag.protectedSimpleLiteral(String label, CoreDatatype datatype)protectedSimpleLiteral(String label, IRI datatype)Creates a new datatyped literal with the supplied label and datatype.protectedSimpleLiteral(String label, IRI datatype, CoreDatatype coreDatatype)Creates a new datatyped literal with the supplied label and datatype.protectedSimpleLiteral(String label, XSD.Datatype datatype)Deprecated, for removal: This API element is subject to removal in a future version.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanbooleanValue()bytebyteValue()XMLGregorianCalendarcalendarValue()BigDecimaldecimalValue()doubledoubleValue()booleanequals(Object o)floatfloatValue()CoreDatatypegetCoreDatatype()IRIgetDatatype()StringgetLabel()Optional<String>getLanguage()Optional<XSD.Datatype>getXsdDatatype()Deprecated, for removal: This API element is subject to removal in a future version.UsegetCoreDatatype()instead.inthashCode()BigIntegerintegerValue()intintValue()longlongValue()protected voidsetDatatype(CoreDatatype datatype)protected voidsetDatatype(IRI datatype)protected voidsetDatatype(IRI datatype, CoreDatatype coreDatatype)protected voidsetDatatype(XSD.Datatype datatype)Deprecated, for removal: This API element is subject to removal in a future version.protected voidsetLabel(String label)protected voidsetLanguage(String language)shortshortValue()StringstringValue()StringtoString()Returns the label of the literal with its language or datatype.-
Methods inherited from class org.eclipse.rdf4j.model.base.AbstractLiteral
temporalAccessorValue, temporalAmountValue
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.rdf4j.model.Value
isBNode, isIRI, isResource, isTriple
-
-
-
-
Constructor Detail
-
SimpleLiteral
protected SimpleLiteral()
-
SimpleLiteral
protected SimpleLiteral(String label)
Creates a new plain literal with the supplied label.- Parameters:
label- The label for the literal, must not be null.
-
SimpleLiteral
protected SimpleLiteral(String label, String language)
Creates a new plain literal with the supplied label and language tag.- Parameters:
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.
-
SimpleLiteral
protected SimpleLiteral(String label, IRI datatype)
Creates a new datatyped literal with the supplied label and datatype.- Parameters:
label- The label for the literal, must not be null.datatype- The datatype for the literal.
-
SimpleLiteral
protected SimpleLiteral(String label, IRI datatype, CoreDatatype coreDatatype)
Creates a new datatyped literal with the supplied label and datatype.- Parameters:
label- The label for the literal, must not be null.datatype- The datatype for the literal.
-
SimpleLiteral
@Deprecated(since="4.0.0", forRemoval=true) protected SimpleLiteral(String label, XSD.Datatype datatype)
Deprecated, for removal: This API element is subject to removal in a future version.
-
SimpleLiteral
protected SimpleLiteral(String label, CoreDatatype datatype)
-
-
Method Detail
-
setLabel
protected void setLabel(String label)
-
getLabel
public String getLabel()
-
setLanguage
protected void setLanguage(String language)
-
setDatatype
protected void setDatatype(IRI datatype)
-
setDatatype
protected void setDatatype(IRI datatype, CoreDatatype coreDatatype)
-
setDatatype
@Deprecated(since="4.0.0", forRemoval=true) protected void setDatatype(XSD.Datatype datatype)
Deprecated, for removal: This API element is subject to removal in a future version.
-
setDatatype
protected void setDatatype(CoreDatatype datatype)
-
getDatatype
public IRI getDatatype()
-
getXsdDatatype
@Deprecated(since="4.0.0", forRemoval=true) public Optional<XSD.Datatype> getXsdDatatype()
Deprecated, for removal: This API element is subject to removal in a future version.UsegetCoreDatatype()instead.- Returns:
-
equals
public boolean equals(Object o)
- Specified by:
equalsin interfaceLiteral- Overrides:
equalsin classAbstractLiteral
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceLiteral- Overrides:
hashCodein classAbstractLiteral
-
toString
public String toString()
Returns the label of the literal with its language or datatype. Note that this method does not escape the quoted label.- Overrides:
toStringin classAbstractLiteral- See Also:
org.eclipse.rdf4j.rio.ntriples.NTriplesUtil#toNTriplesString(org.eclipse.rdf4j.model.Literal)
-
stringValue
public String stringValue()
- Specified by:
stringValuein interfaceValue- Overrides:
stringValuein classAbstractLiteral
-
booleanValue
public boolean booleanValue()
- Specified by:
booleanValuein interfaceLiteral- Overrides:
booleanValuein classAbstractLiteral
-
byteValue
public byte byteValue()
- Specified by:
byteValuein interfaceLiteral- Overrides:
byteValuein classAbstractLiteral
-
shortValue
public short shortValue()
- Specified by:
shortValuein interfaceLiteral- Overrides:
shortValuein classAbstractLiteral
-
intValue
public int intValue()
- Specified by:
intValuein interfaceLiteral- Overrides:
intValuein classAbstractLiteral
-
longValue
public long longValue()
- Specified by:
longValuein interfaceLiteral- Overrides:
longValuein classAbstractLiteral
-
floatValue
public float floatValue()
- Specified by:
floatValuein interfaceLiteral- Overrides:
floatValuein classAbstractLiteral
-
doubleValue
public double doubleValue()
- Specified by:
doubleValuein interfaceLiteral- Overrides:
doubleValuein classAbstractLiteral
-
integerValue
public BigInteger integerValue()
- Specified by:
integerValuein interfaceLiteral- Overrides:
integerValuein classAbstractLiteral
-
decimalValue
public BigDecimal decimalValue()
- Specified by:
decimalValuein interfaceLiteral- Overrides:
decimalValuein classAbstractLiteral
-
calendarValue
public XMLGregorianCalendar calendarValue()
- Specified by:
calendarValuein interfaceLiteral- Overrides:
calendarValuein classAbstractLiteral
-
getCoreDatatype
public CoreDatatype getCoreDatatype()
-
-