org.ldaptive.beans.reflect.ListReflectionTranscoder 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
Provides a mapping, persistence, and code generation API for reading and writing POJOs to an LDAP directory
/* See LICENSE for licensing and NOTICE for copyright. */
package org.ldaptive.beans.reflect;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
/**
* Reflection transcoder for an object that implements {@link List}.
*
* @author Middleware Services
*/
public class ListReflectionTranscoder extends AbstractCollectionReflectionTranscoder
{
/**
* Creates a new list reflection transcoder.
*
* @param c class that is a list
* @param transcoder to operate on elements of the list
*/
public ListReflectionTranscoder(final Class> c, final SingleValueReflectionTranscoder> transcoder)
{
super(c, transcoder);
}
/**
* Creates a new list reflection transcoder.
*
* @param c class that is a list
* @param transcoder to operate on elements of the list
*/
public ListReflectionTranscoder(final Class> c, final ArrayReflectionTranscoder transcoder)
{
super(c, transcoder);
}
@Override
protected Collection createCollection(final Class clazz)
{
final Class> type = getType();
final List l;
if (LinkedList.class.isAssignableFrom(type)) {
l = new LinkedList<>();
} else {
l = new ArrayList<>();
}
return l;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy