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