Package org.ldaptive.beans.reflect
Class ArrayReflectionTranscoder
- java.lang.Object
-
- org.ldaptive.beans.reflect.ArrayReflectionTranscoder
-
- All Implemented Interfaces:
ReflectionTranscoder
public class ArrayReflectionTranscoder extends Object implements ReflectionTranscoder
Reflection transcoder which expects to operate on collections containing an array of values.
-
-
Field Summary
Fields Modifier and Type Field Description private Class<?>
type
Type of array element for this transcoder.private SingleValueReflectionTranscoder<?>
valueTranscoder
Underlying value transcoder.
-
Constructor Summary
Constructors Constructor Description ArrayReflectionTranscoder(SingleValueReflectionTranscoder<?> transcoder)
Creates a new array reflection transcoder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.Class<?>
getType()
Returns the type produced by this transcoder.boolean
supports(Class<?> t)
Returns whether this transcoder can convert object of the supplied type.String
toString()
-
-
-
Field Detail
-
valueTranscoder
private final SingleValueReflectionTranscoder<?> valueTranscoder
Underlying value transcoder.
-
type
private final Class<?> type
Type of array element for this transcoder.
-
-
Constructor Detail
-
ArrayReflectionTranscoder
public ArrayReflectionTranscoder(SingleValueReflectionTranscoder<?> transcoder)
Creates a new array reflection transcoder.- Parameters:
transcoder
- to operate on individual array elements
-
-
Method Detail
-
decodeStringValues
public Object decodeStringValues(Collection<String> values)
Description copied from interface:ReflectionTranscoder
Decodes the supplied values into an object.- Specified by:
decodeStringValues
in interfaceReflectionTranscoder
- Parameters:
values
- to decode- Returns:
- object initialized with the values
-
decodeBinaryValues
public Object decodeBinaryValues(Collection<byte[]> values)
Description copied from interface:ReflectionTranscoder
Decodes the supplied values into an object.- Specified by:
decodeBinaryValues
in interfaceReflectionTranscoder
- Parameters:
values
- to decode- Returns:
- object initialized with the values
-
encodeStringValues
public Collection<String> encodeStringValues(Object values)
Description copied from interface:ReflectionTranscoder
Encodes the supplied value into one or more strings for use in an attribute.- Specified by:
encodeStringValues
in interfaceReflectionTranscoder
- Parameters:
values
- containing data to encode as strings- Returns:
- string attribute values
-
encodeBinaryValues
public Collection<byte[]> encodeBinaryValues(Object values)
Description copied from interface:ReflectionTranscoder
Encodes the supplied value into one or more byte arrays for use in an attribute.- Specified by:
encodeBinaryValues
in interfaceReflectionTranscoder
- Parameters:
values
- containing data to encode as byte arrays- Returns:
- binary attribute values
-
getType
public Class<?> getType()
Description copied from interface:ReflectionTranscoder
Returns the type produced by this transcoder.- Specified by:
getType
in interfaceReflectionTranscoder
- Returns:
- type produced by this transcoder
-
supports
public boolean supports(Class<?> t)
Description copied from interface:ReflectionTranscoder
Returns whether this transcoder can convert object of the supplied type.- Specified by:
supports
in interfaceReflectionTranscoder
- Parameters:
t
- of object- Returns:
- whether the supplied type can be converted
-
-