Package com.apicatalog.rdf.primitive
Class Literal
- java.lang.Object
-
- com.apicatalog.rdf.primitive.Literal
-
- All Implemented Interfaces:
RdfLiteral,RdfTerm
- Direct Known Subclasses:
LangString
public class Literal extends java.lang.Object implements RdfLiteral
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.apicatalog.rdf.model.RdfLiteral
RdfLiteral.Direction
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.Stringdatatype(package private) java.lang.StringlexicalValue
-
Constructor Summary
Constructors Constructor Description Literal(java.lang.String lexicalValue, java.lang.String datatype)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringdatatype()Returns the absolute IRI denoting the datatype of the literal.java.util.Optional<RdfLiteral.Direction>direction()Returns the direction of the literal, which can be either left-to-right (LTR) or right-to-left (RTL).booleanequals(java.lang.Object obj)Compares this RDF term to the specified object.inthashCode()Returns a hash code value for this RDF term.java.util.Optional<java.lang.String>language()Returns an optional language tag associated with the literal.java.lang.StringlexicalValue()Returns the lexical value of the literal.static Literalof(java.lang.String lexicalValue, java.lang.String datatype)java.lang.StringtoString()Returns a string representation of this RDF term.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.apicatalog.rdf.model.RdfLiteral
asLiteral, isLiteral
-
Methods inherited from interface com.apicatalog.rdf.model.RdfTerm
asResource, asTriple, isResource, isTriple
-
-
-
-
Method Detail
-
of
public static Literal of(java.lang.String lexicalValue, java.lang.String datatype)
-
lexicalValue
public java.lang.String lexicalValue()
Description copied from interface:RdfLiteralReturns the lexical value of the literal.The lexical value is the actual content or value of the literal as a string.
- Specified by:
lexicalValuein interfaceRdfLiteral- Returns:
- the lexical value of the literal, never
null
-
datatype
public java.lang.String datatype()
Description copied from interface:RdfLiteralReturns the absolute IRI denoting the datatype of the literal.- Specified by:
datatypein interfaceRdfLiteral- Returns:
- the datatype IRI of the literal, never
null
-
language
public java.util.Optional<java.lang.String> language()
Description copied from interface:RdfLiteralReturns an optional language tag associated with the literal.If the literal is a language-tagged string (e.g. rdf:langString), this method returns the language tag; otherwise, it returns
Optional.empty().- Specified by:
languagein interfaceRdfLiteral- Returns:
- an
Optionalcontaining the language tag if present, orOptional.empty()if not set
-
direction
public java.util.Optional<RdfLiteral.Direction> direction()
Description copied from interface:RdfLiteralReturns the direction of the literal, which can be either left-to-right (LTR) or right-to-left (RTL).- Specified by:
directionin interfaceRdfLiteral- Returns:
- an
Optionalcontaining the direction if present, orOptional.empty()if not set
-
hashCode
public int hashCode()
Description copied from interface:RdfTermReturns a hash code value for this RDF term.- Specified by:
hashCodein interfaceRdfTerm- Overrides:
hashCodein classjava.lang.Object- Returns:
- a hash code consistent with
RdfTerm.equals(Object).
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:RdfTermCompares this RDF term to the specified object. Implementations must override this method to provide equality checks appropriate to the term type.
-
-