T
- The type of converted objects (should be as narrow as possible, so that different converters do not conflict)public abstract class DatadogActionConverter<T> extends Object implements com.thoughtworks.xstream.converters.Converter
VersionedConverter
that encapsulates serialization/deserialization logic for that specific version.
Serialized data contains version in an attribute. When data is deserialized, the version is used to determine which child converter should handle deserialization.
If you want to change serialization format for a specific type,
leave the previous VersionedConverter
instances in place (they will be used to deserialize older data)
and add a new one with a higher version number.
Modifier | Constructor and Description |
---|---|
protected |
DatadogActionConverter(VersionedConverter<T>... converters) |
Modifier and Type | Method and Description |
---|---|
boolean |
canConvert(Class type) |
void |
marshal(Object source,
com.thoughtworks.xstream.io.HierarchicalStreamWriter writer,
com.thoughtworks.xstream.converters.MarshallingContext context) |
Object |
unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader,
com.thoughtworks.xstream.converters.UnmarshallingContext context) |
@SafeVarargs protected DatadogActionConverter(@Nonnull VersionedConverter<T>... converters)
converters
- The list of versioned converters.
Writing is always done with the most up-to-date converter (the one with the maximum version).
Reading is done with the appropriate converter (the one that has version that matches the data version).
If converter with the specified version does not exist, or data has no version attribute (written by an old version of the plugin),
no deserialization is performed.public boolean canConvert(Class type)
canConvert
in interface com.thoughtworks.xstream.converters.ConverterMatcher
public void marshal(Object source, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context)
marshal
in interface com.thoughtworks.xstream.converters.Converter
Copyright © 2016–2024. All rights reserved.