Package org.apache.commons.rdf.simple
Class IRIImpl
- java.lang.Object
-
- org.apache.commons.rdf.simple.IRIImpl
-
- All Implemented Interfaces:
BlankNodeOrIRI
,IRI
,RDFTerm
,SimpleRDF.SimpleRDFTerm
final class IRIImpl extends java.lang.Object implements IRI, SimpleRDF.SimpleRDFTerm
A simple implementation of IRI.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
iri
-
Constructor Summary
Constructors Constructor Description IRIImpl(java.lang.String iri)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Check it this IRI is equal to another IRI.java.lang.String
getIRIString()
Return the IRI encoded as a native Unicode String.
The returned string must not include URL-encoding to escape non-ASCII characters.int
hashCode()
Calculate a hash code for this IRI.java.lang.String
ntriplesString()
Return the term serialised as specified by the RDF-1.1 N-Triples Canonical form.java.lang.String
toString()
-
-
-
Method Detail
-
getIRIString
public java.lang.String getIRIString()
Description copied from interface:IRI
Return the IRI encoded as a native Unicode String.
The returned string must not include URL-encoding to escape non-ASCII characters.- Specified by:
getIRIString
in interfaceIRI
- Returns:
- The IRI encoded as a native Unicode String.
-
ntriplesString
public java.lang.String ntriplesString()
Description copied from interface:RDFTerm
Return the term serialised as specified by the RDF-1.1 N-Triples Canonical form.- Specified by:
ntriplesString
in interfaceRDFTerm
- Returns:
- The term serialised as RDF-1.1 N-Triples.
- See Also:
- RDF-1.1 N-Triples Canonical form
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:IRI
Check it this IRI is equal to another IRI.IRI equality: Two IRIs are equal if and only if they are equivalent under Simple String Comparison according to section 5.1 of [RFC3987]. Further normalization MUST NOT be performed when comparing IRIs for equality.
Two IRI instances are equal if and only if theirIRI.getIRIString()
are equal. Implementations MUST also overrideIRI.hashCode()
so that two equal IRIs produce the same hash code.
-
hashCode
public int hashCode()
Description copied from interface:IRI
Calculate a hash code for this IRI.The returned hash code MUST be equal to the
String.hashCode()
of theIRI.getIRIString()
.This method MUST be implemented in conjunction with
IRI.equals(Object)
so that two equal IRIs produce the same hash code.
-
-