Package com.adobe.epubcheck.opf
Class LinkedResources
- java.lang.Object
-
- com.adobe.epubcheck.opf.LinkedResources
-
public final class LinkedResources extends java.lang.ObjectRepresents a set of linked resources (i.e. resources defined bylinkelements in a Package Document), with predictable iteration order.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLinkedResources.BuilderA builder forLinkedResources.
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<LinkedResource>resourcesprivate java.util.Map<java.lang.String,LinkedResource>resourcesByIdprivate com.google.common.collect.ListMultimap<io.mola.galimatias.URL,LinkedResource>resourcesByURL
-
Constructor Summary
Constructors Modifier Constructor Description privateLinkedResources(java.lang.Iterable<LinkedResource> resources)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<LinkedResource>asList()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>getById(java.lang.String id)Search the linked resource with the given ID.java.util.List<LinkedResource>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 Detail
-
resources
private final java.util.List<LinkedResource> resources
-
resourcesById
private final java.util.Map<java.lang.String,LinkedResource> resourcesById
-
resourcesByURL
private final com.google.common.collect.ListMultimap<io.mola.galimatias.URL,LinkedResource> resourcesByURL
-
-
Constructor Detail
-
LinkedResources
private LinkedResources(java.lang.Iterable<LinkedResource> resources)
-
-
Method Detail
-
getById
public com.google.common.base.Optional<LinkedResource> getById(java.lang.String id)
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
public java.util.List<LinkedResource> getByURL(io.mola.galimatias.URL url)
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
public java.util.List<LinkedResource> 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
public static LinkedResources.Builder builder()
Creates a new builder. Calling this method is identical to calling the emptyLinkedResources.Builderconstructor.- Returns:
- a newly created builder.
-
-