All Downloads are FREE. Search and download functionalities are using the official Maven repository.

info.freelibrary.iiif.presentation.v3.ContentResource Maven / Gradle / Ivy

There is a newer version: 0.12.4
Show newest version

package info.freelibrary.iiif.presentation.v3;

import java.net.URI;
import java.util.Optional;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonSetter;

import info.freelibrary.iiif.presentation.v3.utils.JsonKeys;

/**
 * An interface that defines external web resources that can be referenced. Examples of content resources include:
 * {@link DatasetContent} and {@link ImageContent}).
 *
 * @param  The type of content resource
 */
public interface ContentResource> {

    /**
     * Gets the content resource ID.
     *
     * @return The content resource's ID
     */
    URI getID();

    /**
     * Sets the content resource ID from its string form.
     *
     * @param aID A content resource's ID in string form
     * @return The content resource
     */
    T setID(String aID);

    /**
     * Sets the content resource ID.
     *
     * @param aID A content resource's ID
     * @return The content resource
     */
    T setID(URI aID);

    /**
     * Gets the type of the content resource.
     *
     * @return The type of content resource
     */
    String getType();

    /**
     * Gets the media type format of the content resource.
     *
     * @return The media type format of the content resource
     */
    @JsonIgnore
    Optional getFormat();

    /**
     * Sets the format of the content resource.
     *
     * @param aMediaType A media type
     * @return The content resource
     */
    @JsonIgnore
    T setFormat(MediaType aMediaType);

    /**
     * Sets the format of the resource from a file extension or media type.
     *
     * @param aMediaType A string representation of media type or file extension
     * @return The content resource
     */
    @JsonSetter(JsonKeys.FORMAT)
    T setFormat(String aMediaType);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy