src/main/java/org/ucmtwine/parameter/Parameter.java
public static Parameter create(String name, Class<?> type, boolean required) throws IllegalArgumentException {

    if (InjectedParameter.isValidType(type)) {
      return new InjectedParameter(name, type);
    }

    if (type.isPrimitive() && !required) {
      String msg = "Parameter [" + name + "] found with non-nullable type. Use a wrapper type or change to required";
      throw new IllegalArgumentException(msg);
    }

    Parameter p;

    if (type == String.class) {
      p = new StringParameter(name, type);

    } else if (type == Integer.class || type == int.class) {
      p = new IntegerParameter(name, type);

    } else if (type == Long.class || type == long.class) {
      p = new LongParameter(name, type);

    } else if (type == Float.class || type == float.class) {
      p = new FloatParameter(name, type);

    } else if (type == Double.class || type == double.class) {
      p = new DoubleParameter(name, type);

    } else if (type == Date.class) {
      p = new DateParameter(name, type);

    } else if (type == ResultSet.class || type == DataResultSet.class) {
      p = new ResultSetParameter(name, type);

    } else if (type == Boolean.class || type == boolean.class) {
      p = new BooleanParameter(name, type);

    } else if (type == Provider.class) {
      p = new ProviderParameter(name);
    } else {
      throw new IllegalArgumentException("Parameter type " + type.getName() + " is not valid");
    }

    p.setRequired(required);

    return p;
  }
public static Parameter create(String name, Class<?> type, boolean required) throws IllegalArgumentException {

    if (InjectedParameter.isValidType(type)) {
      return new InjectedParameter(name, type);
    }

    if (type.isPrimitive() && !required) {
      String msg = "Parameter [" + name + "] found with non-nullable type. Use a wrapper type or change to required";
      throw new IllegalArgumentException(msg);
    }

    Parameter p;

    if (type == String.class) {
      p = new StringParameter(name, type);

    } else if (type == Integer.class || type == int.class) {
      p = new IntegerParameter(name, type);

    } else if (type == Long.class || type == long.class) {
      p = new LongParameter(name, type);

    } else if (type == Float.class || type == float.class) {
      p = new FloatParameter(name, type);

    } else if (type == Double.class || type == double.class) {
      p = new DoubleParameter(name, type);

    } else if (type == Date.class) {
      p = new DateParameter(name, type);

    } else if (type == ResultSet.class || type == DataResultSet.class) {
      p = new ResultSetParameter(name, type);

    } else if (type == Boolean.class || type == boolean.class) {
      p = new BooleanParameter(name, type);

    } else if (type == Provider.class) {
      p = new ProviderParameter(name);
    } else {
      throw new IllegalArgumentException("Parameter type " + type.getName() + " is not valid");
    }

    p.setRequired(required);

    return p;
  }
public static Parameter create ( String name , Class < ? > type , boolean required ) throws IllegalArgumentException { if ( InjectedParameter . isValidType ( type ) ) { return new InjectedParameter ( name , type ) ; } if ( type . isPrimitive ( ) && ! required ) { String msg = "Parameter [" + name + "] found with non-nullable type. Use a wrapper type or change to required" ; throw new IllegalArgumentException ( msg ) ; } Parameter p ; if ( type == String . class ) { p = new StringParameter ( name , type ) ; } else if ( type == Integer . class || type == int . class ) { p = new IntegerParameter ( name , type ) ; } else if ( type == Long . class || type == long . class ) { p = new LongParameter ( name , type ) ; } else if ( type == Float . class || type == float . class ) { p = new FloatParameter ( name , type ) ; } else if ( type == Double . class || type == double . class ) { p = new DoubleParameter ( name , type ) ; } else if ( type == Date . class ) { p = new DateParameter ( name , type ) ; } else if ( type == ResultSet . class || type == DataResultSet . class ) { p = new ResultSetParameter ( name , type ) ; } else if ( type == Boolean . class || type == boolean . class ) { p = new BooleanParameter ( name , type ) ; } else if ( type == Provider . class ) { p = new ProviderParameter ( name ) ; } else { throw new IllegalArgumentException ( "Parameter type " + type . getName ( ) + " is not valid" ) ; } p . setRequired ( required ) ; return p ; }
Factory method to create the concrete variable type.

@param name
The name in the binder of the variable.
@return
Factory method to create the concrete variable type .