Class LinkedResources
java.lang.Object
com.adobe.epubcheck.opf.LinkedResources
Represents a set of linked resources (i.e. resources defined by
link elements in a Package Document), with predictable iteration
order.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<LinkedResource> private final Map<String, LinkedResource> private final com.google.common.collect.ListMultimap<io.mola.galimatias.URL, LinkedResource> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasList()Returns the list of all linked resources in this set, in document order.static LinkedResources.Builderbuilder()Creates a new builder.com.google.common.base.Optional<LinkedResource> Search the linked resource with the given ID.getByURL(io.mola.galimatias.URL url) Search the linked resource with the given URL.booleanhasResource(io.mola.galimatias.URL url) Returnstrueif this set contains a linked resource referencing the given resource (or fragment thereof).
-
Field Details
-
resources
-
resourcesById
-
resourcesByURL
private final com.google.common.collect.ListMultimap<io.mola.galimatias.URL, LinkedResource> resourcesByURL
-
-
Constructor Details
-
LinkedResources
-
-
Method Details
-
getById
Search the linked resource with the given ID.- Parameters:
id- the ID of the resource to search, can benull.- Returns:
- An
Optionalcontaining the linked resource if found, orOptional.absent()if not found.
-
getByURL
Search the linked resource with the given URL. All resource whosehrefURL minus fragment is equal to the given URL are returned, in document order.- Parameters:
url- the URL (without fragment) of the resource to search, can benull.- Returns:
- A list of linked resources referencing the resource at
urlor a fragment thereof ; an empty list is returned if no such resource is found.
-
asList
Returns the list of all linked resources in this set, in document order.- Returns:
- the list of all linked resources in this set.
-
hasResource
public boolean hasResource(io.mola.galimatias.URL url) Returnstrueif this set contains a linked resource referencing the given resource (or fragment thereof). -
builder
Creates a new builder. Calling this method is identical to calling the emptyLinkedResources.Builderconstructor.- Returns:
- a newly created builder.
-