|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.serializer.ChainedConverter<S,T>
S
- The source type of the converterT
- The target type of the converterpublic class ChainedConverter<S,T>
A converter that delegates to a chain of other ContentTypeConverters to convert from a source to a target for which there is not necessarily a single converter available.
Constructor Summary | |
---|---|
ChainedConverter(List<ContentTypeConverter> delegates)
Creates a new instance that uses the given delegates to form a chain of converters. |
Method Summary | ||
---|---|---|
static
|
calculateChain(Class<S> sourceType,
Class<T> targetType,
Collection<ContentTypeConverter<?,?>> candidates)
Returns a converter that can convert an IntermediateRepresentation from the given sourceType to the
given targetType using a chain formed with given candidates . |
|
static
|
canConvert(Class<S> sourceContentType,
Class<T> targetContentType,
List<ContentTypeConverter<?,?>> converters)
Indicates whether this converter is capable of converting the given sourceContentType into
targetContentType , using the given converters . |
|
T |
convert(S original)
Converts the given object into another. |
|
SerializedObject<T> |
convert(SerializedObject<S> original)
Converts the data format of the given original IntermediateRepresentation to the target data type. |
|
Class<S> |
expectedSourceType()
The expected type of input data. |
|
Class<T> |
targetType()
The returned type of IntermediateRepresentation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ChainedConverter(List<ContentTypeConverter> delegates)
delegates
to form a chain of converters. Note that the
delegates
must for a Continuous chain, meaning that each item must produce an
IntermediateRepresentation of a type that can be consumed by the next delegate.
To automatically calculate a route between converters, see calculateChain(source, target, candidates)
delegates
- the chain of delegates to perform the conversionMethod Detail |
---|
public static <S,T> ChainedConverter<S,T> calculateChain(Class<S> sourceType, Class<T> targetType, Collection<ContentTypeConverter<?,?>> candidates)
sourceType
to the
given targetType
using a chain formed with given candidates
. The returned converter
uses some (or all) of the given candidates
as delegates.
S
- The source type of the converterT
- The target type of the convertersourceType
- The source type of the convertertargetType
- The target type of the convertercandidates
- The candidates to form a chain with
CannotConvertBetweenTypesException
- if no converter can be created using given candidatespublic static <S,T> boolean canConvert(Class<S> sourceContentType, Class<T> targetContentType, List<ContentTypeConverter<?,?>> converters)
sourceContentType
into
targetContentType
, using the given converters
. When true
, it may use any
number of the given converters
to form a chain.
S
- The content type of the source objectT
- The content type of the target objectsourceContentType
- The content type of the source objecttargetContentType
- The content type of the target objectconverters
- The converters eligible for use
true
if this Converter can convert between the given types, using the given converters.
Otherwise false
.public SerializedObject<T> convert(SerializedObject<S> original)
ContentTypeConverter
original
IntermediateRepresentation to the target data type.
convert
in interface ContentTypeConverter<S,T>
original
- The source to convert
public T convert(S original)
ContentTypeConverter
SerializedObject
instance.
convert
in interface ContentTypeConverter<S,T>
original
- the value to convert
public Class<S> expectedSourceType()
ContentTypeConverter
expectedSourceType
in interface ContentTypeConverter<S,T>
public Class<T> targetType()
ContentTypeConverter
targetType
in interface ContentTypeConverter<S,T>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |