Class ResourceRegistry
- java.lang.Object
-
- org.w3c.epubcheck.core.references.ResourceRegistry
-
public final class ResourceRegistry extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<io.mola.galimatias.URL,java.util.List<java.lang.String>>idsprivate com.google.common.collect.Table<io.mola.galimatias.URL,java.lang.String,Reference.Type>idTypesprivate java.util.Map<io.mola.galimatias.URL,Resource>resources
-
Constructor Summary
Constructors Constructor Description ResourceRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetIDPosition(java.lang.String id, Resource resource)Returns the position of the given ID in the document represented by this resource.Reference.TypegetIDType(java.lang.String id, Resource resource)java.lang.StringgetMimeType(io.mola.galimatias.URL resource)java.util.Optional<OPFItem>getOPFItem(io.mola.galimatias.URL url)Returns anOptionalcontaining the Package Document item for the given Publication Resource path, orOptional#absent()if no resource has been registered for the given path.java.util.Optional<Resource>getResource(io.mola.galimatias.URL url)Returns anOptionalcontaining the Package Document item for the given Publication Resource path, orOptional#absent()if no resource has been registered for the given path.voidregisterID(java.lang.String id, Reference.Type type, io.mola.galimatias.URL resourceURL)voidregisterResource(OPFItem item)voidregisterResource(io.mola.galimatias.URL url, java.lang.String mimetype)
-
-
-
Field Detail
-
resources
private java.util.Map<io.mola.galimatias.URL,Resource> resources
-
ids
private java.util.Map<io.mola.galimatias.URL,java.util.List<java.lang.String>> ids
-
idTypes
private com.google.common.collect.Table<io.mola.galimatias.URL,java.lang.String,Reference.Type> idTypes
-
-
Method Detail
-
registerID
public void registerID(java.lang.String id, Reference.Type type, io.mola.galimatias.URL resourceURL)
-
getIDPosition
public int getIDPosition(java.lang.String id, Resource resource)Returns the position of the given ID in the document represented by this resource.- Parameters:
resource-- Returns:
-1if the ID wasn't found in the document, or0if the given ID isnullor an empty string, or the 1-based position of the ID otherwise.
-
getIDType
public Reference.Type getIDType(java.lang.String id, Resource resource)
-
registerResource
public void registerResource(OPFItem item)
-
registerResource
public void registerResource(io.mola.galimatias.URL url, java.lang.String mimetype)
-
getMimeType
public java.lang.String getMimeType(io.mola.galimatias.URL resource)
-
getOPFItem
public java.util.Optional<OPFItem> getOPFItem(io.mola.galimatias.URL url)
Returns anOptionalcontaining the Package Document item for the given Publication Resource path, orOptional#absent()if no resource has been registered for the given path.
-
getResource
public java.util.Optional<Resource> getResource(io.mola.galimatias.URL url)
Returns anOptionalcontaining the Package Document item for the given Publication Resource path, orOptional#absent()if no resource has been registered for the given path.
-
-