Package org.eclipse.rdf4j.model.base
Class InternedIRI
- java.lang.Object
-
- org.eclipse.rdf4j.model.base.InternedIRI
-
@InternalUseOnly public final class InternedIRI extends java.lang.Object implements IRI
An IRI implementation that interns the stringValue so that two objects can be compared by their stringValue reference. Must only be used for IRIs that are effectively ´public static final´ and only for a very limited number of objects because string interning affects the GC root set (https://shipilev.net/jvm/anatomy-quarks/10-string-intern/).- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private int
hashCode
private java.lang.String
localName
private java.lang.String
namespace
private static long
serialVersionUID
private java.lang.String
stringValue
-
Constructor Summary
Constructors Constructor Description InternedIRI(java.lang.String namespace, java.lang.String localName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Compares this IRI to another object.java.lang.String
getLocalName()
Gets the local name part of this IRI.java.lang.String
getNamespace()
Gets the namespace part of this IRI.int
hashCode()
Computes the hash code of this IRI.private void
readObject(java.io.ObjectInputStream in)
java.lang.String
stringValue()
Returns the String-value of a Value object.java.lang.String
toString()
private void
writeObject(java.io.ObjectOutputStream out)
private void
writeToPrivateFinalField(int value, java.lang.String fieldName)
private void
writeToPrivateFinalField(java.lang.String value, java.lang.String fieldName)
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.rdf4j.model.Resource
isResource
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
namespace
private final java.lang.String namespace
-
localName
private final java.lang.String localName
-
stringValue
private final java.lang.String stringValue
-
hashCode
private final int hashCode
-
-
Method Detail
-
stringValue
public java.lang.String stringValue()
Description copied from interface:Value
Returns the String-value of a Value object. This returns either aLiteral
's label, aIRI
's URI or aBNode
's ID.- Specified by:
stringValue
in interfaceValue
-
getNamespace
public java.lang.String getNamespace()
Description copied from interface:IRI
Gets the namespace part of this IRI.The namespace is defined as per the algorithm described in the class documentation.
- Specified by:
getNamespace
in interfaceIRI
- Returns:
- the namespace of this IRI
-
getLocalName
public java.lang.String getLocalName()
Description copied from interface:IRI
Gets the local name part of this IRI.The local name is defined as per the algorithm described in the class documentation.
- Specified by:
getLocalName
in interfaceIRI
- Returns:
- the local name of this IRI
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
Description copied from interface:IRI
Compares this IRI to another object.- Specified by:
equals
in interfaceIRI
- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- the object to compare this IRI to- Returns:
true
, if the other object is an instance ofIRI
and their string values are equal;false
, otherwise
-
hashCode
public int hashCode()
Description copied from interface:IRI
Computes the hash code of this IRI.- Specified by:
hashCode
in interfaceIRI
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- a hash code for this IRI computed as
Value.stringValue()
.hashCode()
-
writeObject
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
readObject
private void readObject(java.io.ObjectInputStream in) throws java.lang.ClassNotFoundException, java.io.IOException
- Throws:
java.lang.ClassNotFoundException
java.io.IOException
-
writeToPrivateFinalField
private void writeToPrivateFinalField(java.lang.String value, java.lang.String fieldName)
-
writeToPrivateFinalField
private void writeToPrivateFinalField(int value, java.lang.String fieldName)
-
-