Record Class Identifier

java.lang.Object
java.lang.Record
is.galia.image.Identifier
Record Components:
value - Value.
All Implemented Interfaces:
Comparable<Identifier>

public record Identifier(String value) extends Record implements Comparable<Identifier>

Immutable application-unique source image file/object identifier.

This may be one component of a MetaIdentifier, which may include additional information, such as a page number.

Input

When identifiers are supplied to the application via URIs, they must go through some processing steps before they can be used (order is important):

  1. URI decoding
  2. slash decoding

(fromURI(String) will handle all of this.)

Output

The input steps must be reversed for output. Note that requests can supply a AbstractResource.PUBLIC_IDENTIFIER_HEADER to suggest that the identifier supplied in a URI is different from the one the user agent is seeing and supplying to a reverse proxy.

So, the steps for output are:

  1. Replace the URI identifier with the one from AbstractResource.PUBLIC_IDENTIFIER_HEADER, if present
  2. Encode slashes
  3. URI encoding
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of a Identifier record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compareTo(Identifier identifier)
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    static Identifier
    fromURI(String uriValue)
    Translates the string in a raw URI path component or query into a new instance.
    final int
    Returns a hash code value for this object.
    Returns a string representation of this record class.
    Returns the value of the value record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Identifier

      public Identifier(String value)
      Creates an instance of a Identifier record class.
      Parameters:
      value - the value for the value record component
  • Method Details

    • fromURI

      public static Identifier fromURI(String uriValue)
      Translates the string in a raw URI path component or query into a new instance.
      Parameters:
      uriValue - Raw URI path component or query.
      See Also:
    • compareTo

      public int compareTo(Identifier identifier)
      Specified by:
      compareTo in interface Comparable<Identifier>
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • value

      public String value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component