Class InternedIRI

java.lang.Object
org.eclipse.rdf4j.model.base.InternedIRI
All Implemented Interfaces:
Serializable, IRI, Resource, Value

@InternalUseOnly public final class InternedIRI extends 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:
  • Constructor Details

    • InternedIRI

      public InternedIRI(String namespace, String localName)
  • Method Details

    • stringValue

      public String stringValue()
      Description copied from interface: Value
      Returns the String-value of a Value object. This returns either a Literal's label, a IRI's URI or a BNode's ID.
      Specified by:
      stringValue in interface Value
    • getNamespace

      public 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 interface IRI
      Returns:
      the namespace of this IRI
    • getLocalName

      public 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 interface IRI
      Returns:
      the local name of this IRI
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Description copied from interface: IRI
      Compares this IRI to another object.
      Specified by:
      equals in interface IRI
      Overrides:
      equals in class Object
      Parameters:
      o - the object to compare this IRI to
      Returns:
      true, if the other object is an instance of IRI 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 interface IRI
      Overrides:
      hashCode in class Object
      Returns:
      a hash code for this IRI computed as Value.stringValue().hashCode()