org.ldaptive.beans.reflect.AbstractCollectionReflectionTranscoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ldaptive-beans Show documentation
Show all versions of ldaptive-beans Show documentation
Mapping, persistence, and code generation API for reading and writing POJOs to an LDAP directory
The newest version!
/* See LICENSE for licensing and NOTICE for copyright. */
package org.ldaptive.beans.reflect;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* Reflection transcoder for an object that implements a {@link Collection}.
*
* @author Middleware Services
*/
public abstract class AbstractCollectionReflectionTranscoder implements ReflectionTranscoder
{
/** Type that is a collection. */
private final Class> type;
/** Used for collections that do not contain arrays. */
private final SingleValueReflectionTranscoder> singleValueTranscoder;
/** Used for collections that contain arrays. */
private final ArrayReflectionTranscoder arrayTranscoder;
/**
* Creates a new abstract collection reflection transcoder.
*
* @param c class that is a collection
* @param transcoder to operate on elements of the collection
*/
public AbstractCollectionReflectionTranscoder(final Class> c, final SingleValueReflectionTranscoder> transcoder)
{
type = c;
singleValueTranscoder = transcoder;
arrayTranscoder = null;
}
/**
* Creates a new abstract collection reflection transcoder.
*
* @param c class that is a collection
* @param transcoder to operate on elements of the collection
*/
public AbstractCollectionReflectionTranscoder(final Class> c, final ArrayReflectionTranscoder transcoder)
{
type = c;
singleValueTranscoder = null;
arrayTranscoder = transcoder;
}
@Override
public Object decodeStringValues(final Collection values)
{
final Collection