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 java.lang.Object implements ReflectionTranscoder
Reflection transcoder for an object that implements aCollection
.- Author:
- Middleware Services
-
-
Constructor Summary
Constructors Constructor Description AbstractCollectionReflectionTranscoder(java.lang.Class<?> c, ArrayReflectionTranscoder transcoder)
Creates a new abstract collection reflection transcoder.AbstractCollectionReflectionTranscoder(java.lang.Class<?> c, SingleValueReflectionTranscoder<?> transcoder)
Creates a new abstract collection reflection transcoder.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract <T> java.util.Collection<T>
createCollection(java.lang.Class<T> clazz)
Returns a collection implementation of the correct type for this transcoder.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.java.lang.Class<?>
getType()
Returns the type produced by this transcoder.boolean
supports(java.lang.Class<?> t)
Returns whether this transcoder can convert object of the supplied type.java.lang.String
toString()
-
-
-
Constructor Detail
-
AbstractCollectionReflectionTranscoder
public AbstractCollectionReflectionTranscoder(java.lang.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
public AbstractCollectionReflectionTranscoder(java.lang.Class<?> c, ArrayReflectionTranscoder transcoder)
Creates a new abstract collection reflection transcoder.- Parameters:
c
- class that is a collectiontranscoder
- to operate on elements of the collection
-
-
Method Detail
-
decodeStringValues
public java.lang.Object decodeStringValues(java.util.Collection<java.lang.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 java.lang.Object decodeBinaryValues(java.util.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 java.util.Collection<java.lang.String> encodeStringValues(java.lang.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 java.util.Collection<byte[]> encodeBinaryValues(java.lang.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
-
createCollection
protected abstract <T> java.util.Collection<T> createCollection(java.lang.Class<T> clazz)
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
public java.lang.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(java.lang.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
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-