mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Nicolas Capponi
26.31.2013 efa949b25f472d7e4c39733678d8f0e5229f8201
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/DefinedDefaultBehaviorProvider.java
@@ -25,68 +25,55 @@
 */
package org.opends.server.admin;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
/**
 * A default behavior provider which represents a well-defined set of default
 * values. It should be used by properties which have default value(s) which are
 * valid value(s) according to the constraints of the property's definition.
 *
 * @param <T>
 *          The type of values represented by this provider.
 *            The type of values represented by this provider.
 */
public final class DefinedDefaultBehaviorProvider<T> extends
    DefaultBehaviorProvider<T> {
public final class DefinedDefaultBehaviorProvider<T> extends DefaultBehaviorProvider<T> {
  // The collection of default values.
  private final Collection<String> values;
    // The collection of default values.
    private final Collection<String> values;
  /**
   * Create a new defined default behavior provider associated with the
   * specified list of values.
   *
   * @param values
   *          The list of values (must be non-<code>null</code> and not
   *          empty) in their string representation.
   * @throws IllegalArgumentException
   *           If the list of values was <code>null</code> or empty.
   */
  public DefinedDefaultBehaviorProvider(String... values)
      throws IllegalArgumentException {
    if (values == null || values.length == 0) {
      throw new IllegalArgumentException(
          "Null or empty list of default values");
    /**
     * Create a new defined default behavior provider associated with the
     * specified list of values.
     *
     * @param values
     *            The list of values (must be non-<code>null</code> and not
     *            empty) in their string representation.
     * @throws IllegalArgumentException
     *             If the list of values was <code>null</code> or empty.
     */
    public DefinedDefaultBehaviorProvider(String... values) {
        if (values == null || values.length == 0) {
            throw new IllegalArgumentException("Null or empty list of default values");
        }
        this.values = Arrays.asList(values);
    }
    this.values = Arrays.asList(values);
  }
    /**
     * {@inheritDoc}
     */
    public <R, P> R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p) {
        return v.visitDefined(this, p);
    }
  /**
   * {@inheritDoc}
   */
  public <R, P> R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p) {
    return v.visitDefined(this, p);
  }
  /**
   * Get a copy of the default values.
   *
   * @return Returns a newly allocated collection containing a copy of the
   *         default values.
   */
  public Collection<String> getDefaultValues() {
    return new ArrayList<String>(values);
  }
    /**
     * Get a copy of the default values.
     *
     * @return Returns a newly allocated collection containing a copy of the
     *         default values.
     */
    public Collection<String> getDefaultValues() {
        return new ArrayList<String>(values);
    }
}