Package nl.knaw.dans.bagit.domain
Class Metadata
java.lang.Object
nl.knaw.dans.bagit.domain.Metadata
A class to represent the bag-info.txt (and package-info.txt in older versions)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd a entry into the metadata or append a value if the label already existsvoidadd multiple metadata entriesbooleancheck if the metadata contains a particular label(key)booleanget all the values for a specific label (key)getAll()all the metadataprotected List<AbstractMap.SimpleImmutableEntry<String,String>> getList()getMap()inthashCode()booleanisEmpty()voidremove the label and all its valuesprotected voidprotected voidtoString()booleanupsertPayloadOxum(String payloadOxumValue) payload oxum is a special case where it makes no sense to have multiple values so instead of just appending we upsert (insert or update)
-
Field Details
-
PAYLOAD_OXUM
- See Also:
-
map
-
list
-
-
Constructor Details
-
Metadata
public Metadata()
-
-
Method Details
-
toString
-
hashCode
public int hashCode() -
equals
-
getAll
all the metadata- Returns:
- return the order and case preserved metadata
-
get
get all the values for a specific label (key)- Parameters:
key- the case insensitive label(key) in the metadata- Returns:
- the list of values for that label
-
add
add a entry into the metadata or append a value if the label already exists- Parameters:
key- the labelvalue- the value of the label- Returns:
- true (as specified by
Collection.add(E))
-
remove
remove the label and all its values- Parameters:
key- the label to remove along with its value(s)
-
contains
check if the metadata contains a particular label(key)- Parameters:
key- the label to check- Returns:
- if the label exists
-
addAll
add multiple metadata entries- Parameters:
data- the metadata to add
-
upsertPayloadOxum
payload oxum is a special case where it makes no sense to have multiple values so instead of just appending we upsert (insert or update)- Parameters:
payloadOxumValue- the value payload-oxum should be set to- Returns:
- true (as specified by
Collection.add(E))
-
isEmpty
public boolean isEmpty()- Returns:
- true if this metadata contains no entries
-
getMap
-
setMap
-
getList
-
setList
-