Class MetadataContainer
- java.lang.Object
-
- hudson.model.InvisibleAction
-
- com.google.jenkins.plugins.metadata.MetadataContainer
-
- All Implemented Interfaces:
Action
,ModelObject
public class MetadataContainer extends InvisibleAction
A build'sInvisibleAction
containing metadata. This is intended as append-only store for metadata information. Metadata providing code simply calladd(MetadataValue)
to contribute metadata, andgetMetadata()
to consume metadata.
-
-
Constructor Summary
Constructors Constructor Description MetadataContainer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MetadataContainer
add(MetadataValue mv)
Add aMetadataValue
to this container.<T extends MetadataValue>
MetadataContaineraddAll(Iterable<T> mvs)
add
a list of elements<T extends MetadataValue>
Tdeserialize(Class<T> clazz, String serialized)
com.google.common.collect.Multimap<String,MetadataValue>
getMetadata()
static com.google.common.collect.Multimap<String,MetadataValue>
getMetadata(Run<?,?> build)
Map<String,String>
getSerializedMetadata()
<T extends MetadataValue>
Iterable<T>listDeserialize(Class<T> clazz, String serialized)
<T extends MetadataValue>
StringlistSerialize(Iterable<T> values)
static MetadataContainer
of(Run<?,?> build)
void
removeAll(String key)
remove
a list of elementsString
serialize(MetadataValue metadataValue)
-
Methods inherited from class hudson.model.InvisibleAction
getDisplayName, getIconFileName, getUrlName
-
-
-
-
Method Detail
-
getMetadata
public com.google.common.collect.Multimap<String,MetadataValue> getMetadata()
- Returns:
- the metadata contained.
-
add
public MetadataContainer add(MetadataValue mv)
Add aMetadataValue
to this container.- Parameters:
mv
- the givenMetadataValue
to add.- Returns:
- this
MetadataContainer
.
-
addAll
public <T extends MetadataValue> MetadataContainer addAll(Iterable<T> mvs)
add
a list of elements
-
removeAll
public void removeAll(String key)
remove
a list of elements
-
getSerializedMetadata
public Map<String,String> getSerializedMetadata()
- Returns:
- the serialized form of the metadata;
-
of
public static MetadataContainer of(Run<?,?> build)
- Parameters:
build
- a given build.- Returns:
- the
MetadataContainer
for the given build.
-
serialize
public String serialize(MetadataValue metadataValue) throws MetadataSerializationException
- Parameters:
metadataValue
- the metadata value to be serialized.- Returns:
- serialized form of the given
MetadataValue
. - Throws:
MetadataSerializationException
- when serialization runs into problem.
-
listSerialize
public <T extends MetadataValue> String listSerialize(Iterable<T> values)
- Parameters:
values
- the metadata values to be serialized.- Returns:
- serialized form of the given
MetadataValue
. - Throws:
MetadataSerializationException
- when serialization runs into problem.
-
deserialize
public <T extends MetadataValue> T deserialize(Class<T> clazz, String serialized)
- Parameters:
clazz
- class of theMetadataValue
object to be deserialized.serialized
- the string to deserialize.- Returns:
- the deserialized
MetadataValue
object.
-
listDeserialize
public <T extends MetadataValue> Iterable<T> listDeserialize(Class<T> clazz, String serialized)
- Parameters:
clazz
- the class of theMetadataValue
to be deserialize.serialized
- the serialized form to be deserialized.- Returns:
- a list of deserialized objects.
-
getMetadata
public static com.google.common.collect.Multimap<String,MetadataValue> getMetadata(Run<?,?> build)
- Parameters:
build
- a givenRun
.- Returns:
- the metadata contained in the
MetadataContainer
of the givenRun
.
-
-