org.ldaptive.beans.reflect
Class AbstractCollectionReflectionTranscoder

java.lang.Object
  extended by 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.

Version:
$Revision: 3013 $ $Date: 2014-07-02 11:26:52 -0400 (Wed, 02 Jul 2014) $
Author:
Middleware Services

Constructor Summary
AbstractCollectionReflectionTranscoder(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
protected abstract
<T> Collection<T>
createCollection(Class<T> clazz)
          Returns a collection implementation of the correct type for this transcoder.
 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()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractCollectionReflectionTranscoder

public AbstractCollectionReflectionTranscoder(Class<?> c,
                                              SingleValueReflectionTranscoder<?> transcoder)
Creates a new abstract collection reflection transcoder.

Parameters:
c - class that is a collection
transcoder - to operate on elements of the collection

AbstractCollectionReflectionTranscoder

public AbstractCollectionReflectionTranscoder(Class<?> c,
                                              ArrayReflectionTranscoder transcoder)
Creates a new abstract collection reflection transcoder.

Parameters:
c - class that is a collection
transcoder - to operate on elements of the collection
Method Detail

decodeStringValues

public Object decodeStringValues(Collection<String> values)
Decodes the supplied values into an object.

Specified by:
decodeStringValues in interface ReflectionTranscoder
Parameters:
values - to decode
Returns:
object initialized with the values

decodeBinaryValues

public Object decodeBinaryValues(Collection<byte[]> values)
Decodes the supplied values into an object.

Specified by:
decodeBinaryValues in interface ReflectionTranscoder
Parameters:
values - to decode
Returns:
object initialized with the values

encodeStringValues

public Collection<String> encodeStringValues(Object values)
Encodes the supplied value into one or more strings for use in an attribute.

Specified by:
encodeStringValues in interface ReflectionTranscoder
Parameters:
values - containing data to encode as strings
Returns:
string attribute values

encodeBinaryValues

public Collection<byte[]> encodeBinaryValues(Object values)
Encodes the supplied value into one or more byte arrays for use in an attribute.

Specified by:
encodeBinaryValues in interface ReflectionTranscoder
Parameters:
values - containing data to encode as byte arrays
Returns:
binary attribute values

createCollection

protected abstract <T> Collection<T> createCollection(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 Class<?> getType()
Returns the type produced by this transcoder.

Specified by:
getType in interface ReflectionTranscoder
Returns:
type produced by this transcoder

supports

public boolean supports(Class<?> t)
Returns whether this transcoder can convert object of the supplied type.

Specified by:
supports in interface ReflectionTranscoder
Parameters:
t - of object
Returns:
whether the supplied type can be converted

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2003-2015 Virginia Tech. All Rights Reserved.