Package org.ldaptive.beans.reflect
Class AbstractCollectionReflectionTranscoder
java.lang.Object
org.ldaptive.beans.reflect.AbstractCollectionReflectionTranscoder
- All Implemented Interfaces:
ReflectionTranscoder
- Direct Known Subclasses:
ListReflectionTranscoder
,SetReflectionTranscoder
public abstract class AbstractCollectionReflectionTranscoder
extends Object
implements ReflectionTranscoder
Reflection transcoder for an object that implements a
Collection
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ArrayReflectionTranscoder
Used for collections that contain arrays.private final SingleValueReflectionTranscoder<?>
Used for collections that do not contain arrays.private final Class<?>
Type that is a collection. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractCollectionReflectionTranscoder
(Class<?> c, ArrayReflectionTranscoder transcoder) Creates a new abstract collection reflection transcoder.AbstractCollectionReflectionTranscoder
(Class<?> c, SingleValueReflectionTranscoder<?> transcoder) Creates a new abstract collection reflection transcoder. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract <T> Collection<T>
createCollection
(Class<T> clazz) Returns a collection implementation of the correct type for this transcoder.decodeBinaryValues
(Collection<byte[]> values) Decodes the supplied values into an 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.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
Returns whether this transcoder can convert object of the supplied type.toString()
-
Field Details
-
type
Type that is a collection. -
singleValueTranscoder
Used for collections that do not contain arrays. -
arrayTranscoder
Used for collections that contain arrays.
-
-
Constructor Details
-
AbstractCollectionReflectionTranscoder
public AbstractCollectionReflectionTranscoder(Class<?> c, SingleValueReflectionTranscoder<?> transcoder) Creates a new abstract collection reflection transcoder.- Parameters:
c
- class that is a collectiontranscoder
- to operate on elements of the collection
-
AbstractCollectionReflectionTranscoder
Creates a new abstract collection reflection transcoder.- Parameters:
c
- class that is a collectiontranscoder
- to operate on elements of the collection
-
-
Method Details
-
decodeStringValues
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
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
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
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
-
createCollection
Returns a collection implementation of the correct type for this transcoder.- Type Parameters:
T
- type of collection- Parameters:
clazz
- type of collection- Returns:
- collection implementation
-
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
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
-
toString
-