Class OPFItem

java.lang.Object
com.adobe.epubcheck.opf.OPFItem

public class OPFItem extends Object
Immutable representation of an item in a Package Document (OPF). Can represent a item element or link elements pointing to a container resource.
  • Field Details

    • id

      private final String id
    • url

      private final io.mola.galimatias.URL url
    • location

      private final EPUBLocation location
    • path

      private final String path
    • mimetype

      private final String mimetype
    • hasFallback

      private final boolean hasFallback
    • hasCoreMediaTypeFallback

      private final boolean hasCoreMediaTypeFallback
    • hasContentDocumentFallback

      private final boolean hasContentDocumentFallback
    • properties

      private final Set<Property> properties
    • ncx

      private final boolean ncx
    • inSpine

      private final boolean inSpine
    • spinePosition

      private final int spinePosition
    • scripted

      private final boolean scripted
    • linear

      private final boolean linear
    • fixedLayout

      private final boolean fixedLayout
    • remote

      private final boolean remote
    • mediaOverlay

      private final String mediaOverlay
  • Constructor Details

  • Method Details

    • getId

      public String getId()
      Returns the ID of this item.
      Returns:
      the ID of this item, guaranteed non-null.
    • getURL

      public io.mola.galimatias.URL getURL()
      The URL of this item (cannot be null).
      Returns:
      the container URL of this item
    • getPath

      public String getPath()
      The path of this item (cannot be null).
      Returns:
      the path of this item
    • getMimeType

      public String getMimeType()
      Returns the media type of this item.
      Returns:
      the media type of this item, guaranteed non-null.
    • getLocation

      public EPUBLocation getLocation()
      Returns:
      the location in the package document where this item is declared
    • hasFallback

      public boolean hasFallback()
      Returns whether this package document item defines a fallback to another item.
      Returns:
      true iff this item has a fallback item.
    • hasCoreMediaTypeFallback

      public boolean hasCoreMediaTypeFallback()
      Returns whether this item is a core media type resource, or has a core media type resource in its fallback chain.
      Returns:
      true iff a core media type resource was found in the fallback chain (can be itself)
    • hasContentDocumentFallback

      public boolean hasContentDocumentFallback()
      Returns whether this item is itself an EPUB content document, or has an EPUB content document in its fallback chain.
      Returns:
      true iff an EPUB content document was found in the fallback chain (can be itself)
    • getProperties

      public Set<Property> getProperties()
      Returns the set of Property declared on this item or any itemref pointing to this item.
      Returns:
      the properties of this item, or an empty set if none is declared.
    • getSpinePosition

      public int getSpinePosition()
      Returns the zero-based position of this item in the spine, or -1 if this item is not in the spine.
      Returns:
      the position of this item in the spine, or -1 if this item is not in the spine.
    • isNcx

      public boolean isNcx()
      Returns true iff this item is an NCX document.
      Returns:
      true iff this item is an NCX document.
    • isScripted

      public boolean isScripted()
      Returns true iff this item is a scripted document.
      Returns:
      true iff this item is a scripted document.
    • isNav

      public boolean isNav()
      Returns true iff this item is a Navigation Document.
      Returns:
      true iff this item is an Navigation Document.
    • isInSpine

      public boolean isInSpine()
      Returns true iff this item is in the spine.
      Returns:
      true iff this item is in the spine.
    • isLinear

      public boolean isLinear()
      Returns true iff this item is a spine item part of the linear reading order, as declared by the itemref/@linear attribute.
      Returns:
      true iff this item is in the spine and is linear.
      Throws:
      IllegalStateException - if this item is not in the spine.
    • isFixedLayout

      public boolean isFixedLayout()
      Returns true iff this item is a Fixed-Layout Document.
      Returns:
      true iff this item is a Fixed-Layout Document.
    • hasDataURL

      public boolean hasDataURL()
      Returns true iff this item is a remote resource.
      Returns:
      true iff this item is a remote resource.
    • isRemote

      public boolean isRemote()
      Returns true iff this item is a remote resource.
      Returns:
      true iff this item is a remote resource.
    • getMediaOverlay

      public String getMediaOverlay()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object