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 aMetaIdentifierrecord class.MetaIdentifier(String identifier) Creates a minimal valid instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic MetaIdentifier.Builderbuilder()final booleanIndicates whether some other object is "equal to" this one.static MetaIdentifierfromString(String string, Delegate delegate) Deserializes the given meta-identifier string using theMetaIdentifierTransformerspecified in the application configuration.static MetaIdentifierTranslates the string in a raw URI path component or query into a new instance using theMetaIdentifierTransformerspecified in the application configuration.final inthashCode()Returns a hash code value for this object.Returns the value of theidentifierrecord component.Returns the value of thepageNumberrecord component.Returns the value of thescaleConstraintrecord 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 aMetaIdentifierrecord class.- Parameters:
identifier- the value for theidentifierrecord componentpageNumber- the value for thepageNumberrecord componentscaleConstraint- the value for thescaleConstraintrecord component
-
-
Method Details
-
builder
-
fromString
Deserializes the given meta-identifier string using the
MetaIdentifierTransformerspecified 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 theMetaIdentifierTransformerspecified in the application configuration.- Parameters:
uriValue- Raw URI value from the path or query.delegate- Delegate.- See Also:
-
forURI
-
rebuilder
- Returns:
Reference.Builderof 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 theidentifierrecord component.- Returns:
- the value of the
identifierrecord component
-
pageNumber
Returns the value of thepageNumberrecord component.- Returns:
- the value of the
pageNumberrecord component
-
scaleConstraint
Returns the value of thescaleConstraintrecord component.- Returns:
- the value of the
scaleConstraintrecord component
-