org.eclipse.rdf4j.model.impl

## Class SimpleIRI

- java.lang.Object
- - org.eclipse.rdf4j.model.impl.SimpleIRI

- All Implemented Interfaces:
    Serializable, IRI, Resource, URI, Value
  Direct Known Subclasses:
    NativeIRI, URIImpl

      public class SimpleIRI
      extends Object
      implements IRI

  The default implementation of the `IRI` interface.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `SimpleIRI()` Creates a new, un-initialized IRI.
    `protected` | `SimpleIRI(String iriString)` Creates a new IRI from the supplied string.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)` Compares a IRI object to another object.
    `String` | `getLocalName()` Gets the local name part of this IRI.
    `String` | `getNamespace()` Gets the namespace part of this IRI.
    `int` | `hashCode()` The hash code of an IRI is defined as the hash code of its String-representation: `toString().hashCode`.
    `protected void` | `setIRIString(String iriString)`
    `String` | `stringValue()` Returns the String-value of a `Value` object.
    `String` | `toString()` Returns the String-representation of this IRI.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SimpleIRI

          protected SimpleIRI()

      Creates a new, un-initialized IRI. This IRI's string value needs to be `set` before the normal methods can be used.

    - #### SimpleIRI

          protected SimpleIRI(String iriString)

      Creates a new IRI from the supplied string.

      Note that creating SimpleIRI objects directly via this constructor is not the recommended approach. Instead, use a `ValueFactory` (obtained from your repository or by using `SimpleValueFactory.getInstance()`) to create new IRI objects.

      Parameters:
        `iriString` - A String representing a valid, absolute IRI. May not be `null`.
      Throws:
        `IllegalArgumentException` - If the supplied IRI is not a valid (absolute) IRI.
      See Also:
        `AbstractValueFactory.createIRI(String)`

  - ### Method Detail

    - #### setIRIString

          protected void setIRIString(String iriString)

    - #### toString

          public String toString()

      Description copied from interface: `IRI`
      Returns the String-representation of this IRI.
      Specified by:
        `toString` in interface `IRI`
      Specified by:
        `toString` in interface `URI`
      Overrides:
        `toString` in class `Object`
      Returns:
        The String-representation of this IRI.

    - #### 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`
      Specified by:
        `getNamespace` in interface `URI`
      Returns:
        The IRI's namespace.

    - #### 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`
      Specified by:
        `getLocalName` in interface `URI`
      Returns:
        The IRI's local name.

    - #### equals

          public boolean equals(Object o)

      Description copied from interface: `IRI`
      Compares a IRI object to another object.
      Specified by:
        `equals` in interface `IRI`
      Specified by:
        `equals` in interface `URI`
      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-representations are equal, `false` otherwise.

    - #### hashCode

          public int hashCode()

      Description copied from interface: `IRI`
      The hash code of an IRI is defined as the hash code of its String-representation: `toString().hashCode`.
      Specified by:
        `hashCode` in interface `IRI`
      Specified by:
        `hashCode` in interface `URI`
      Overrides:
        `hashCode` in class `Object`
      Returns:
        A hash code for the IRI.

Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.