Record Class MetaIdentifier
- Record Components:
identifier
- Identifier component.pageNumber
- Page number component, which may benull
.scaleConstraint
- Scale constraint component, which may benull
.
An Identifier
is used to uniquely identify a source image file
or object. But a client may require more specificity than this—for
example, to be able to retrieve a particular page from within a multi-page
image, and/or at a particular scale limit. Ideally these parameters would be
supplied as arguments to the image request API service, but said service may
not support them. (This is the case for the IIIF Image API, at least,
through version 3.0.)
Thus this class, which joins meta-information about an identifier with the identifier itself, for utilization by an image-request API that doesn't natively support such information.
Input
When meta-identifiers are supplied to the application via URIs, they must go through some processing steps before they can be used (order is important):
- URI decoding
slash decoding
(fromURI(String, Delegate)
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 meta-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:
- Replace the URI meta-identifier with the one from
AbstractResource.PUBLIC_IDENTIFIER_HEADER
, if present - Encode slashes
- URI encoding
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionMetaIdentifier
(Identifier identifier) Creates a minimal valid instance.MetaIdentifier
(Identifier identifier, Integer pageNumber, ScaleConstraint scaleConstraint) Creates an instance of aMetaIdentifier
record class.MetaIdentifier
(String identifier) Creates a minimal valid instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic MetaIdentifier.Builder
builder()
final boolean
Indicates whether some other object is "equal to" this one.static MetaIdentifier
fromString
(String string, Delegate delegate) Deserializes the given meta-identifier string using theMetaIdentifierTransformer
specified in the application configuration.static MetaIdentifier
Translates the string in a raw URI path component or query into a new instance using theMetaIdentifierTransformer
specified in the application configuration.final int
hashCode()
Returns a hash code value for this object.Returns the value of theidentifier
record component.Returns the value of thepageNumber
record component.Returns the value of thescaleConstraint
record component.toString()
Returns a string representation of this record class.
-
Constructor Details
-
MetaIdentifier
Creates a minimal valid instance. For more options, useMetaIdentifier.Builder
. -
MetaIdentifier
Creates a minimal valid instance. For more options, useMetaIdentifier.Builder
. -
MetaIdentifier
Creates an instance of aMetaIdentifier
record class.- Parameters:
identifier
- the value for theidentifier
record componentpageNumber
- the value for thepageNumber
record componentscaleConstraint
- the value for thescaleConstraint
record component
-
-
Method Details
-
builder
-
fromString
Deserializes the given meta-identifier string using the
MetaIdentifierTransformer
specified in the application configuration.This is a shortcut to using
MetaIdentifierTransformerFactory
.- Returns:
- New deserialized instance.
-
fromURI
Translates the string in a raw URI path component or query into a new instance using theMetaIdentifierTransformer
specified in the application configuration.- Parameters:
uriValue
- Raw URI value from the path or query.delegate
- Delegate.- See Also:
-
forURI
-
rebuilder
- Returns:
Reference.Builder
of a new instance based on this one.
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object)
. -
identifier
Returns the value of theidentifier
record component.- Returns:
- the value of the
identifier
record component
-
pageNumber
Returns the value of thepageNumber
record component.- Returns:
- the value of the
pageNumber
record component
-
scaleConstraint
Returns the value of thescaleConstraint
record component.- Returns:
- the value of the
scaleConstraint
record component
-