Class Parameters


  • public final class Parameters
    extends Object
    This class provides a few static utility methods to extracts parameters from an array.
    Version:
    $Id$
    Author:
    Fabrizio Giudici
    Status: stable API
    • Method Detail

      • find

        @CheckForNull
        public static <T,​O> T find​(@Nonnull
                                         Class<T> parameterClass,
                                         @CheckForNull
                                         T defaultOption,
                                         @Nonnull
                                         O... parameters)
                                  throws IllegalArgumentException
        Extracts a singled-value parameter of the given type from an array. If the parameter is not found, the default value is returned. If more than a single parameter is found, an IllegalparameterException is thrown.
        Parameters:
        parameterClass - the class of the parameter to retrieve
        defaultOption - the default value of the parameter
        parameters - the array of parameters
        Throws:
        IllegalparameterException - if more than a single value is found
        IllegalArgumentException
      • find

        @Nonnull
        public static <T,​O> Collection<T> find​(@Nonnull
                                                     Class<T> parameterClass,
                                                     @Nonnull
                                                     O... parameters)
        Extracts multiple-value parameters of the given type from an array. If the parameter is not found, an empty collection is returned.
        Parameters:
        parameterClass - the class of the parameter to retrieve
        parameters - the array of parameters