Class MetadataSet
java.lang.Object
com.adobe.epubcheck.opf.MetadataSet
Represents a set of metadata as declared in the
metadata element
in an EPUB Publication document (OPF).
The graph of refines is resolved when building the metadata set.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA builder for sets of metadata expressions.static final classRepresents a metadata expression. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.google.common.collect.SetMultimap<Property, MetadataSet.Metadata> private final com.google.common.base.Supplier<Set<MetadataSet.Metadata>> private final com.google.common.collect.SetMultimap<Property, MetadataSet.Metadata> private final com.google.common.base.Supplier<Set<MetadataSet.Metadata>> private final com.google.common.collect.SetMultimap<String, MetadataSet.Metadata> private final Map<MetadataSet.Metadata, MetadataSet.Metadata> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateMetadataSet(com.google.common.collect.Multimap<Property, MetadataSet.Metadata> all, com.google.common.collect.Multimap<Property, MetadataSet.Metadata> primary, Map<MetadataSet.Metadata, MetadataSet.Metadata> refines, com.google.common.collect.Multimap<String, MetadataSet.Metadata> refiners) -
Method Summary
Modifier and TypeMethodDescriptionstatic MetadataSet.Builderbuilder()Creates a new builder.booleancontainsAny(Property property) Returnstrueif this metadata set contains an expression (primary or subexpression) for the given propertybooleancontainsPrimary(Property property) Returnstrueif this metadata set contains a primary expression for the given propertybooleancontainsPrimary(Property property, String value) Returnstrueif this metadata set contains a primary expression for the given property and the given valuegetAll()Returns a set of all metadata expressions (primary+subexpressions).Returns the set of all metadata expressions (primary and subexpressions) for the given property.Returns a set of all primary metadata expressions.getPrimary(Property property) Returns the set of metadata primary expressions for the given property.com.google.common.base.Optional<MetadataSet.Metadata> Returns an optional metadata expression refined by the given metadata expression.getRefining(String id) Returns the set of all metadata subexpressions refining the metadata or resource identified by the given ID.static com.google.common.base.Optional<MetadataSet.Metadata> tryFind(Set<MetadataSet.Metadata> metas, Property property, com.google.common.base.Optional<String> value) Search all the given expressions and return the first one that matches the given property and value (if present).static com.google.common.base.Optional<MetadataSet.Metadata> tryFindInRefines(Set<MetadataSet.Metadata> metas, Property property, com.google.common.base.Optional<String> value) Search all refining expressions of the given metadata expressions, and return the first one that matches the given property and value (if present).
-
Field Details
-
all
-
-
refiners
-
refines
-
allSet
-
primarySet
-
-
Constructor Details
-
MetadataSet
private MetadataSet(com.google.common.collect.Multimap<Property, MetadataSet.Metadata> all, com.google.common.collect.Multimap<Property, MetadataSet.Metadata> primary, Map<MetadataSet.Metadata, MetadataSet.Metadata> refines, com.google.common.collect.Multimap<String, MetadataSet.Metadata> refiners)
-
-
Method Details
-
getPrimary
Returns a set of all primary metadata expressions.- Returns:
- an immutable set (possibly empty) of all primary metadata expressions.
-
getAll
Returns a set of all metadata expressions (primary+subexpressions).- Returns:
- an immutable set (possibly empty) of all metadata expressions.
-
containsPrimary
Returnstrueif this metadata set contains a primary expression for the given property- Parameters:
property- a property from a metadata vocabulary- Returns:
trueif this metadata set contains a primary expression for the given property
-
containsPrimary
Returnstrueif this metadata set contains a primary expression for the given property and the given value- Parameters:
property- a property from a metadata vocabularyvalue- the value to search- Returns:
trueif this metadata set contains a primary expression for the given property and value
-
containsAny
Returnstrueif this metadata set contains an expression (primary or subexpression) for the given property- Parameters:
property- a property from a metadata vocabulary- Returns:
trueif this metadata set contains an expression for the given property
-
getPrimary
Returns the set of metadata primary expressions for the given property.- Parameters:
property- a property from a metadata vocabulary- Returns:
- the set of metadata primary expressions for the given property, or an empty set if none exist.
-
getAny
Returns the set of all metadata expressions (primary and subexpressions) for the given property.- Parameters:
property- a property from a metadata vocabulary- Returns:
- the set of all metadata expressions for the given property, or an empty set if none exist.
-
getRefinedBy
public com.google.common.base.Optional<MetadataSet.Metadata> getRefinedBy(MetadataSet.Metadata meta) Returns an optional metadata expression refined by the given metadata expression.- Parameters:
meta- a metadata expression- Returns:
Optional.absent()if the given metadata expression does not refine another metadata expression or acontaining the refined metadata expressioninvalid reference
Optional#of(Metadata)
-
getRefining
Returns the set of all metadata subexpressions refining the metadata or resource identified by the given ID.- Parameters:
id- a string ID- Returns:
- the set of all metadata subexpressions refining the given ID, or an empty set if none exist.
-
tryFindInRefines
public static com.google.common.base.Optional<MetadataSet.Metadata> tryFindInRefines(Set<MetadataSet.Metadata> metas, Property property, com.google.common.base.Optional<String> value) Search all refining expressions of the given metadata expressions, and return the first one that matches the given property and value (if present).If
, only the property is used in the lookup.valueisOptional.absent()- Parameters:
metas- A set of metadata expressions to searchproperty- The property of the searched expressionvalue- The value of the searched expression, can be absent if the value is not relevant in the search- Returns:
- an
Optionalcontaining an expression refining one of the expressions inmetasand matching the given property and value, orOptional.absent()if none is found.
-
tryFind
public static com.google.common.base.Optional<MetadataSet.Metadata> tryFind(Set<MetadataSet.Metadata> metas, Property property, com.google.common.base.Optional<String> value) Search all the given expressions and return the first one that matches the given property and value (if present).If
, only the property is used in the lookup.valueisOptional.absent()- Parameters:
metas- A set of metadata expressions to searchproperty- The property of the searched expressionvalue- The value of the searched expression, can be absent if the value is not relevant in the search- Returns:
- an
Optionalcontaining an expression in themetasset matching the given property and value, orOptional.absent()if none is found.
-
builder
Creates a new builder. Calling this method is identical to calling the emptyMetadataSet.Builderconstructor.- Returns:
- a newly created builder.
-