Class OPFItem


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

      Nested Classes 
      Modifier and Type Class Description
      static class  OPFItem.Builder
      A builder for OPFItem
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private OPFItem​(OPFItem.Builder builder)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.lang.String getId()
      Returns the ID of this item.
      EPUBLocation getLocation()  
      java.lang.String getMediaOverlay()  
      java.lang.String getMimeType()
      Returns the media type of this item.
      java.lang.String getPath()
      The path of this item (cannot be null).
      java.util.Set<Property> getProperties()
      Returns the set of Property declared on this item or any itemref pointing to this item.
      int getSpinePosition()
      Returns the zero-based position of this item in the spine, or -1 if this item is not in the spine.
      io.mola.galimatias.URL getURL()
      The URL of this item (cannot be null).
      boolean hasContentDocumentFallback()
      Returns whether this item is itself an EPUB content document, or has an EPUB content document in its fallback chain.
      boolean hasCoreMediaTypeFallback()
      Returns whether this item is a core media type resource, or has a core media type resource in its fallback chain.
      boolean hasDataURL()
      Returns true iff this item is a remote resource.
      boolean hasFallback()
      Returns whether this package document item defines a fallback to another item.
      int hashCode()  
      boolean isFixedLayout()
      Returns true iff this item is a Fixed-Layout Document.
      boolean isInSpine()
      Returns true iff this item is in the spine.
      boolean isLinear()
      Returns true iff this item is a spine item part of the linear reading order, as declared by the itemref/@linear attribute.
      boolean isNav()
      Returns true iff this item is a Navigation Document.
      boolean isNcx()
      Returns true iff this item is an NCX document.
      boolean isRemote()
      Returns true iff this item is a remote resource.
      boolean isScripted()
      Returns true iff this item is a scripted document.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • id

        private final java.lang.String id
      • url

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

        private final java.lang.String path
      • mimetype

        private final java.lang.String mimetype
      • hasFallback

        private final boolean hasFallback
      • hasCoreMediaTypeFallback

        private final boolean hasCoreMediaTypeFallback
      • hasContentDocumentFallback

        private final boolean hasContentDocumentFallback
      • properties

        private final java.util.Set<Property> properties
      • ncx

        private final boolean ncx
      • inSpine

        private final boolean inSpine
      • spinePosition

        private final int spinePosition
      • nav

        private final boolean nav
      • scripted

        private final boolean scripted
      • linear

        private final boolean linear
      • fixedLayout

        private final boolean fixedLayout
      • remote

        private final boolean remote
      • mediaOverlay

        private final java.lang.String mediaOverlay
    • Method Detail

      • getId

        public java.lang.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 java.lang.String getPath()
        The path of this item (cannot be null).
        Returns:
        the path of this item
      • getMimeType

        public java.lang.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 java.util.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:
        java.lang.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 java.lang.String getMediaOverlay()
      • toString

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

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object