public class DefaultReflectionTranscoder extends java.lang.Object implements ReflectionTranscoder
| Modifier and Type | Field and Description |
|---|---|
private SingleValueReflectionTranscoder<?> |
customTranscoder
Custom transcoder to override the default transcoder.
|
protected org.slf4j.Logger |
logger
Logger for this class.
|
private java.util.Set<SingleValueReflectionTranscoder<?>> |
singleValueTranscoders
Set of transcoders support single values.
|
private ReflectionTranscoder |
valueTranscoder
Transcoder for this type.
|
| Constructor and Description |
|---|
DefaultReflectionTranscoder(java.lang.reflect.Type type)
Creates a new default reflection transcoder.
|
DefaultReflectionTranscoder(java.lang.reflect.Type type,
ValueTranscoder<?> transcoder)
Creates a new default reflection transcoder.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
decodeBinaryValues(java.util.Collection<byte[]> values)
Decodes the supplied values into an object.
|
java.lang.Object |
decodeStringValues(java.util.Collection<java.lang.String> values)
Decodes the supplied values into an object.
|
java.util.Collection<byte[]> |
encodeBinaryValues(java.lang.Object values)
Encodes the supplied value into one or more byte arrays for use in an attribute.
|
java.util.Collection<java.lang.String> |
encodeStringValues(java.lang.Object values)
Encodes the supplied value into one or more strings for use in an attribute.
|
protected ReflectionTranscoder |
getCollectionEncoder(java.lang.Class<?> type,
java.lang.reflect.Type genericType)
Returns the appropriate collection encoder for the supplied type.
|
protected java.util.Set<SingleValueReflectionTranscoder<?>> |
getDefaultSingleValueTranscoders()
Initializes the set of default single value transcoders.
|
protected SingleValueReflectionTranscoder |
getSingleValueReflectionTranscoder(java.lang.Class<?> type)
Returns the appropriate single value encoder for the supplied type.
|
java.lang.Class<?> |
getType()
Returns the type produced by this transcoder.
|
boolean |
supports(java.lang.Class<?> type)
Returns whether this transcoder can convert object of the supplied type.
|
java.lang.String |
toString() |
protected final org.slf4j.Logger logger
private final SingleValueReflectionTranscoder<?> customTranscoder
private final ReflectionTranscoder valueTranscoder
private final java.util.Set<SingleValueReflectionTranscoder<?>> singleValueTranscoders
public DefaultReflectionTranscoder(java.lang.reflect.Type type)
type - of object to transcodepublic DefaultReflectionTranscoder(java.lang.reflect.Type type,
ValueTranscoder<?> transcoder)
type - of object to transcodetranscoder - custom transcoder for this typeprotected java.util.Set<SingleValueReflectionTranscoder<?>> getDefaultSingleValueTranscoders()
protected SingleValueReflectionTranscoder getSingleValueReflectionTranscoder(java.lang.Class<?> type)
type - to provide a single value encoder forprotected ReflectionTranscoder getCollectionEncoder(java.lang.Class<?> type, java.lang.reflect.Type genericType)
type - to provide a collection encoder forgenericType - of the collectionpublic java.lang.Object decodeStringValues(java.util.Collection<java.lang.String> values)
ReflectionTranscoderdecodeStringValues in interface ReflectionTranscodervalues - to decodepublic java.lang.Object decodeBinaryValues(java.util.Collection<byte[]> values)
ReflectionTranscoderdecodeBinaryValues in interface ReflectionTranscodervalues - to decodepublic java.util.Collection<java.lang.String> encodeStringValues(java.lang.Object values)
ReflectionTranscoderencodeStringValues in interface ReflectionTranscodervalues - containing data to encode as stringspublic java.util.Collection<byte[]> encodeBinaryValues(java.lang.Object values)
ReflectionTranscoderencodeBinaryValues in interface ReflectionTranscodervalues - containing data to encode as byte arrayspublic java.lang.Class<?> getType()
ReflectionTranscodergetType in interface ReflectionTranscoderpublic boolean supports(java.lang.Class<?> type)
ReflectionTranscodersupports in interface ReflectionTranscodertype - of objectpublic java.lang.String toString()
toString in class java.lang.Object