Class ResourceRegistry

java.lang.Object
org.w3c.epubcheck.core.references.ResourceRegistry

public final class ResourceRegistry extends Object
  • Field Details

    • resources

      private Map<io.mola.galimatias.URL, Resource> resources
    • ids

      private Map<io.mola.galimatias.URL, List<String>> ids
    • idTypes

      private com.google.common.collect.Table<io.mola.galimatias.URL, String, Reference.Type> idTypes
  • Constructor Details

    • ResourceRegistry

      public ResourceRegistry()
  • Method Details

    • registerID

      public void registerID(String id, Reference.Type type, io.mola.galimatias.URL resourceURL)
    • getIDPosition

      public int getIDPosition(String id, Resource resource)
      Returns the position of the given ID in the document represented by this resource.
      Parameters:
      resource -
      Returns:
      -1 if the ID wasn't found in the document, or 0 if the given ID is null or an empty string, or the 1-based position of the ID otherwise.
    • getIDType

      public Reference.Type getIDType(String id, Resource resource)
    • registerResource

      public void registerResource(OPFItem item)
    • registerResource

      public void registerResource(io.mola.galimatias.URL url, String mimetype)
    • getMimeType

      public String getMimeType(io.mola.galimatias.URL resource)
    • getOPFItem

      public Optional<OPFItem> getOPFItem(io.mola.galimatias.URL url)
      Returns an Optional containing the Package Document item for the given Publication Resource path, or
      invalid reference
      Optional#absent()
      if no resource has been registered for the given path.
    • getResource

      public Optional<Resource> getResource(io.mola.galimatias.URL url)
      Returns an Optional containing the Package Document item for the given Publication Resource path, or
      invalid reference
      Optional#absent()
      if no resource has been registered for the given path.