All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ldaptive.beans.reflect.ListReflectionTranscoder Maven / Gradle / Ivy

Go to download

Provides a mapping, persistence, and code generation API for reading and writing POJOs to an LDAP directory

There is a newer version: 2.4.0
Show 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.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