Example usage for java.lang Long TYPE

List of usage examples for java.lang Long TYPE

Introduction

In this page you can find the example usage for java.lang Long TYPE.

Prototype

Class TYPE

To view the source code for java.lang Long TYPE.

Click Source Link

Document

The Class instance representing the primitive type long .

Usage

From source file:org.onebusaway.gtfs_transformer.deferred.DeferredValueConverter.java

private boolean isPrimitiveAssignable(Class<?> expectedValueType, Class<?> actualValueType) {
    if (!expectedValueType.isPrimitive()) {
        return false;
    }/*from   w w w .j a  v  a2s .com*/
    return expectedValueType == Double.TYPE
            && (actualValueType == Double.class || actualValueType == Float.class)
            || expectedValueType == Long.TYPE && (actualValueType == Long.class
                    || actualValueType == Integer.class || actualValueType == Short.class)
            || expectedValueType == Integer.TYPE
                    && (actualValueType == Integer.class || actualValueType == Short.class)
            || expectedValueType == Short.TYPE && (actualValueType == Short.class)
            || expectedValueType == Boolean.TYPE && (actualValueType == Boolean.class);
}

From source file:org.skfiy.typhon.spi.GMConsoleProvider.java

/**
 *
 * @param uid//ww w  .  j  av a 2s  . co  m
 * @param propertyName
 * @param val
 * @throws javax.management.MBeanException
 */
public void changeProperty(final String uid, final String propertyName, final String val)
        throws MBeanException {
    try {
        invoke(transcoding(uid), new Handler() {

            @Override
            void execute() {
                Player player = SessionUtils.getPlayer();
                try {
                    Class<?> propertyType = PropertyUtils.getPropertyType(player, propertyName);
                    if (propertyType == null) { // Not found property
                        throw new IllegalArgumentException("Not found property[" + propertyName + "]");
                    }

                    if (propertyType == Byte.class || propertyType == Byte.TYPE) {
                        BeanUtils.setProperty(player, propertyName, Byte.valueOf(val));
                    } else if (propertyType == Character.class || propertyType == Character.TYPE) {
                        BeanUtils.setProperty(player, propertyName, val.charAt(0));
                    } else if (propertyType == Boolean.class || propertyType == Boolean.TYPE) {
                        BeanUtils.setProperty(player, propertyName, Boolean.valueOf(val));
                    } else if (propertyType == Integer.class || propertyType == Integer.TYPE) {
                        BeanUtils.setProperty(player, propertyName, Integer.valueOf(val));
                    } else if (propertyType == Long.class || propertyType == Long.TYPE) {
                        BeanUtils.setProperty(player, propertyName, Long.valueOf(val));
                    } else if (propertyType == Float.class || propertyType == Float.TYPE) {
                        BeanUtils.setProperty(player, propertyName, Float.valueOf(val));
                    } else if (propertyType == Double.class || propertyType == Double.TYPE) {
                        BeanUtils.setProperty(player, propertyName, Double.valueOf(val));
                    } else {
                        BeanUtils.setProperty(player, propertyName, val);
                    }

                } catch (Exception ex) {
                    throw new IllegalArgumentException(ex.getMessage());
                }
            }

        });
    } catch (Exception e) {
        throw new MBeanException(e, e.getMessage());
    }
}

From source file:com.ms.commons.summer.web.util.json.JsonNumberMorpher.java

public Object morph(Object value) {
    if (value != null && type.isAssignableFrom(value.getClass())) {
        // no conversion needed
        return value;
    }//  w ww .  j  a va 2  s  . c om

    String str = String.valueOf(value).trim();

    if (!type.isPrimitive() && (value == null || str.length() == 0 || "null".equalsIgnoreCase(str))) {
        // if empty string and class != primitive treat it like null
        return null;
    }

    try {
        if (isDecimalNumber(type)) {
            if (Float.class.isAssignableFrom(type) || Float.TYPE == type) {
                return morphToFloat(str);
            } else if (Double.class.isAssignableFrom(type) || Double.TYPE == type) {
                return morphToDouble(str);
            } else {
                return morphToBigDecimal(str);
            }
        } else {
            if (Byte.class.isAssignableFrom(type) || Byte.TYPE == type) {
                return morphToByte(str);
            } else if (Short.class.isAssignableFrom(type) || Short.TYPE == type) {
                return morphToShort(str);
            } else if (Integer.class.isAssignableFrom(type) || Integer.TYPE == type) {
                return morphToInteger(str);
            } else if (Long.class.isAssignableFrom(type) || Long.TYPE == type) {
                return morphToLong(str);
            } else {
                return morphToBigInteger(str);
            }
        }
    } catch (ConvertErrorException e) {
        // JsonPropertyConvertContext.setConvertError((ConvertErrorException) e);
        return null;
    }
}

From source file:org.wrml.runtime.schema.PropertyProtoSlot.java

PropertyProtoSlot(final Prototype prototype, final String slotName, final Property property) {

    super(prototype, slotName);

    if (property == null) {
        throw new NullPointerException(
                "Prototype (" + prototype + ") Slot (" + slotName + ") property cannot be null.");
    }// w w  w. j a v  a2  s  .c om

    _Property = property;

    final Type heapValueType = getHeapValueType();

    final SyntaxLoader syntaxLoader = getContext().getSyntaxLoader();

    final DefaultValue defaultValue = getAnnotation(DefaultValue.class);
    if (defaultValue != null) {
        final String defaultValueString = defaultValue.value();

        try {
            _DefaultValue = syntaxLoader.parseSyntacticText(defaultValueString, heapValueType);
        } catch (final Exception e) {

            throw new PrototypeException(prototype + " slot named \"" + slotName
                    + "\" default value annotation's value could not be converted from text value \""
                    + defaultValueString + "\" to a Java " + heapValueType + ". Detail message: "
                    + e.getMessage(), e, prototype, slotName);
        }
    }

    if (Boolean.TYPE.equals(heapValueType)) {
        if (_DefaultValue == null) {
            _DefaultValue = Boolean.FALSE;
        }
    } else if (TypeUtils.isAssignable(heapValueType, Enum.class)) {

        if (_DefaultValue == null) {
            // Enum's default to their first constant
            // Single selects default to the first choice
            @SuppressWarnings("unchecked")
            final Class<Enum<?>> enumValueType = (Class<Enum<?>>) heapValueType;
            if (enumValueType != null) {
                final Enum<?>[] enumChoices = enumValueType.getEnumConstants();
                if (enumChoices != null && enumChoices.length > 0) {
                    _DefaultValue = enumChoices[0];
                }
            }
        }

    } else if (TypeUtils.isAssignable(heapValueType, Number.class) || Integer.TYPE.equals(heapValueType)
            || Long.TYPE.equals(heapValueType) || Double.TYPE.equals(heapValueType)) {

        if (_DefaultValue == null && Integer.TYPE.equals(heapValueType) || Long.TYPE.equals(heapValueType)
                || Double.TYPE.equals(heapValueType)) {
            _DefaultValue = getValueType().getDefaultValue();
        }

        // isolate()
        {
            final MinimumValue minimumValue = getAnnotation(MinimumValue.class);
            if (minimumValue != null) {
                final String minimumValueString = minimumValue.value();

                try {
                    _MinimumValue = syntaxLoader.parseSyntacticText(minimumValueString, heapValueType);
                } catch (final Exception e) {

                    throw new PrototypeException(prototype + " slot named \"" + slotName
                            + "\" minimum value annotation's value could not be converted from text value \""
                            + minimumValueString + "\" to a Java " + heapValueType + ". Detail message: "
                            + e.getMessage(), e, prototype, slotName);
                }

                _IsExclusiveMinimum = minimumValue.exclusive();

            }
        }

        // isolate()
        {
            final MaximumValue maximumValue = getAnnotation(MaximumValue.class);
            if (maximumValue != null) {
                final String maximumValueString = maximumValue.value();

                try {
                    _MaximumValue = syntaxLoader.parseSyntacticText(maximumValueString, heapValueType);
                } catch (final Exception e) {

                    throw new PrototypeException(prototype + " slot named \"" + slotName
                            + "\" maximum value annotation's value could not be converted from text value \""
                            + maximumValueString + "\" to a Java " + heapValueType + ". Detail message: "
                            + e.getMessage(), e, prototype, slotName);
                }

                _IsExclusiveMaximum = maximumValue.exclusive();
            }
        }

        // isolate()
        {
            final DivisibleByValue divisibleByValue = getAnnotation(DivisibleByValue.class);
            if (divisibleByValue != null &&
            // The "divisible by" constraint does not apply to doubles
                    !Double.TYPE.equals(heapValueType)
                    && !TypeUtils.isAssignable(heapValueType, Double.class)) {
                final String divisibleByValueString = divisibleByValue.value();

                try {
                    _DivisibleByValue = syntaxLoader.parseSyntacticText(divisibleByValueString, heapValueType);
                } catch (final Exception e) {

                    throw new PrototypeException(prototype + " slot named \"" + slotName
                            + "\" divisibleBy value annotation's value could not be converted from text value \""
                            + divisibleByValueString + "\" to a Java " + heapValueType + ". Detail message: "
                            + e.getMessage(), e, prototype, slotName);
                }

                if (_DivisibleByValue.equals(0)) {
                    throw new PrototypeException(prototype + " slot named \"" + slotName
                            + "\" divisibleBy value annotation's value could not be converted from text value \""
                            + divisibleByValueString + "\" to a Java " + heapValueType + ". Detail message: "
                            + "zero value", null, prototype, slotName);

                }

            }
        }

        // isolate()
        {
            final DisallowedValues disallowedValues = getAnnotation(DisallowedValues.class);
            if (disallowedValues != null) {
                final String[] disallowedValuesArray = disallowedValues.value();
                if (disallowedValuesArray != null) {
                    _DisallowedValues = new LinkedHashSet<>(disallowedValuesArray.length);
                    for (final String disallowedValueString : disallowedValuesArray) {

                        final Object disallowedValue = syntaxLoader.parseSyntacticText(disallowedValueString,
                                heapValueType);

                        _DisallowedValues.add(disallowedValue);
                    }
                }
            }
        }

    } else if (String.class.equals(heapValueType)) {

        final MinimumLength minimumLength = getAnnotation(MinimumLength.class);
        if (minimumLength != null) {
            _MinimumLength = minimumLength.value();
        }

        final MaximumLength maximumLength = getAnnotation(MaximumLength.class);
        if (maximumLength != null) {
            _MaximumLength = maximumLength.value();
        }

        final Multiline multiline = getAnnotation(Multiline.class);
        if (multiline != null) {
            _IsMultiline = true;
        }

        final DisallowedValues disallowedValues = getAnnotation(DisallowedValues.class);
        if (disallowedValues != null) {
            final String[] disallowedValuesArray = disallowedValues.value();
            if (disallowedValuesArray != null) {
                _DisallowedValues = new LinkedHashSet<>(disallowedValuesArray.length);
                _DisallowedValues.addAll(Arrays.asList(disallowedValuesArray));
            }
        }

    } else if (TypeUtils.isAssignable(heapValueType, Collection.class)) {

        final MinimumSize minimumSize = getAnnotation(MinimumSize.class);
        if (minimumSize != null) {
            _MinimumSize = minimumSize.value();
        }

        final MaximumSize maximumSize = getAnnotation(MaximumSize.class);
        if (maximumSize != null) {
            _MaximumSize = maximumSize.value();
        }

    }

    final Searchable searchable = getAnnotation(Searchable.class);
    if (searchable != null) {
        _Searchable = true;
    }

}

From source file:jef.tools.ArrayUtils.java

/**
 * ?//w w w. j  ava 2  s .  c o  m
 * 
 * @param obj
 * @return
 */
public static Object[] toObject(Object obj) {
    Class<?> c = obj.getClass();
    Assert.isTrue(c.isArray());
    Class<?> priType = c.getComponentType();
    if (!priType.isPrimitive())
        return (Object[]) obj;
    if (priType == Boolean.TYPE) {
        return toObject((boolean[]) obj);
    } else if (priType == Byte.TYPE) {
        return toObject((byte[]) obj);
    } else if (priType == Character.TYPE) {
        return toObject((char[]) obj);
    } else if (priType == Integer.TYPE) {
        return toObject((int[]) obj);
    } else if (priType == Long.TYPE) {
        return toObject((long[]) obj);
    } else if (priType == Float.TYPE) {
        return toObject((float[]) obj);
    } else if (priType == Double.TYPE) {
        return toObject((double[]) obj);
    } else if (priType == Short.TYPE) {
        return toObject((short[]) obj);
    }
    throw new IllegalArgumentException();
}

From source file:uk.ac.imperial.presage2.db.json.JsonStorage.java

private <T> T returnAsType(JsonNode n, Class<T> type) {
    if (type == String.class)
        return type.cast(n.textValue());
    else if (type == Integer.class || type == Integer.TYPE)
        return type.cast(n.asInt());
    else if (type == Double.class || type == Double.TYPE)
        return type.cast(n.asDouble());
    else if (type == Boolean.class || type == Boolean.TYPE)
        return type.cast(n.asBoolean());
    else if (type == Long.class || type == Long.TYPE)
        return type.cast(n.asLong());

    throw new RuntimeException("Unknown type cast request");
}

From source file:org.evosuite.regression.ObjectFields.java

private static Object getFieldValue(Field field, Object p) {
    try {/*from  w  ww  . ja v a 2  s . c  om*/
        /*Class objClass = p.getClass();
        if(p instanceof java.lang.String){
           ((String) p).hashCode();
        }*/
        Class<?> fieldType = field.getType();
        field.setAccessible(true);
        if (fieldType.isPrimitive()) {
            if (fieldType.equals(Boolean.TYPE)) {
                return field.getBoolean(p);
            }
            if (fieldType.equals(Integer.TYPE)) {
                return field.getInt(p);
            }
            if (fieldType.equals(Byte.TYPE)) {
                return field.getByte(p);
            }
            if (fieldType.equals(Short.TYPE)) {
                return field.getShort(p);
            }
            if (fieldType.equals(Long.TYPE)) {
                return field.getLong(p);
            }
            if (fieldType.equals(Double.TYPE)) {
                return field.getDouble(p);
            }
            if (fieldType.equals(Float.TYPE)) {
                return field.getFloat(p);
            }
            if (fieldType.equals(Character.TYPE)) {
                return field.getChar(p);
            }
            throw new UnsupportedOperationException("Primitive type " + fieldType + " not implemented!");
        }
        return field.get(p);
    } catch (IllegalAccessException exc) {
        throw new RuntimeException(exc);
    } catch (OutOfMemoryError e) {
        e.printStackTrace();
        if (MAX_RECURSION != 0)
            MAX_RECURSION = 0;
        else
            throw new RuntimeErrorException(e);
        return getFieldValue(field, p);
    }
}

From source file:org.apache.sling.models.impl.model.AbstractInjectableElement.java

private static Object getDefaultValue(AnnotatedElement element, Type type,
        InjectAnnotationProcessor2 annotationProcessor) {
    if (annotationProcessor != null && annotationProcessor.hasDefault()) {
        return annotationProcessor.getDefault();
    }//w ww.j ava 2 s  . c om

    Default defaultAnnotation = element.getAnnotation(Default.class);
    if (defaultAnnotation == null) {
        return null;
    }

    Object value = null;

    if (type instanceof Class) {
        Class<?> injectedClass = (Class<?>) type;
        if (injectedClass.isArray()) {
            Class<?> componentType = injectedClass.getComponentType();
            if (componentType == String.class) {
                value = defaultAnnotation.values();
            } else if (componentType == Integer.TYPE) {
                value = defaultAnnotation.intValues();
            } else if (componentType == Integer.class) {
                value = ArrayUtils.toObject(defaultAnnotation.intValues());
            } else if (componentType == Long.TYPE) {
                value = defaultAnnotation.longValues();
            } else if (componentType == Long.class) {
                value = ArrayUtils.toObject(defaultAnnotation.longValues());
            } else if (componentType == Boolean.TYPE) {
                value = defaultAnnotation.booleanValues();
            } else if (componentType == Boolean.class) {
                value = ArrayUtils.toObject(defaultAnnotation.booleanValues());
            } else if (componentType == Short.TYPE) {
                value = defaultAnnotation.shortValues();
            } else if (componentType == Short.class) {
                value = ArrayUtils.toObject(defaultAnnotation.shortValues());
            } else if (componentType == Float.TYPE) {
                value = defaultAnnotation.floatValues();
            } else if (componentType == Float.class) {
                value = ArrayUtils.toObject(defaultAnnotation.floatValues());
            } else if (componentType == Double.TYPE) {
                value = defaultAnnotation.doubleValues();
            } else if (componentType == Double.class) {
                value = ArrayUtils.toObject(defaultAnnotation.doubleValues());
            } else {
                log.warn("Default values for {} are not supported", componentType);
            }
        } else {
            if (injectedClass == String.class) {
                value = defaultAnnotation.values().length == 0 ? "" : defaultAnnotation.values()[0];
            } else if (injectedClass == Integer.class) {
                value = defaultAnnotation.intValues().length == 0 ? 0 : defaultAnnotation.intValues()[0];
            } else if (injectedClass == Long.class) {
                value = defaultAnnotation.longValues().length == 0 ? 0l : defaultAnnotation.longValues()[0];
            } else if (injectedClass == Boolean.class) {
                value = defaultAnnotation.booleanValues().length == 0 ? false
                        : defaultAnnotation.booleanValues()[0];
            } else if (injectedClass == Short.class) {
                value = defaultAnnotation.shortValues().length == 0 ? ((short) 0)
                        : defaultAnnotation.shortValues()[0];
            } else if (injectedClass == Float.class) {
                value = defaultAnnotation.floatValues().length == 0 ? 0f : defaultAnnotation.floatValues()[0];
            } else if (injectedClass == Double.class) {
                value = defaultAnnotation.doubleValues().length == 0 ? 0d : defaultAnnotation.doubleValues()[0];
            } else {
                log.warn("Default values for {} are not supported", injectedClass);
            }
        }
    } else {
        log.warn("Cannot provide default for {}", type);
    }
    return value;
}

From source file:org.projectforge.continuousdb.TableAttribute.java

/**
 * Creates a property and gets the information from the entity class. The JPA annotations Column, JoinColumn, Entity,
 * Table and ID are supported.//from w ww .ja  v  a 2 s  .c o  m
 *
 * @param clazz
 * @param property
 */
public TableAttribute(final Class<?> clazz, final String property) {
    final Method getterMethod = BeanHelper.determineGetter(clazz, property, false);
    if (getterMethod == null) {
        throw new IllegalStateException("Can't determine getter: " + clazz + "." + property);
    }
    this.entityClass = clazz;
    this.property = property;
    this.name = property;
    this.propertyType = BeanHelper.determinePropertyType(getterMethod);
    // final boolean typePropertyPresent = false;
    // final String typePropertyValue = null;
    for (final TableAttributeHook hook : hooks) {
        this.type = hook.determineType(getterMethod);
        if (this.type != null) {
            break;
        }
    }
    final boolean primitive = this.propertyType.isPrimitive();
    if (JPAHelper.isPersistenceAnnotationPresent(getterMethod) == false) {
        log.warn(
                "************** ProjectForge schema updater expect JPA annotations at getter method such as @Column for proper functioning!");
    }
    if (this.type != null) {
        // Type is already determined.
    } else if (Boolean.class.isAssignableFrom(this.propertyType) == true
            || Boolean.TYPE.isAssignableFrom(this.propertyType) == true) {
        this.type = TableAttributeType.BOOLEAN;
    } else if (Integer.class.isAssignableFrom(this.propertyType) == true
            || Integer.TYPE.isAssignableFrom(this.propertyType) == true) {
        this.type = TableAttributeType.INT;
    } else if (Long.class.isAssignableFrom(this.propertyType) == true
            || Long.TYPE.isAssignableFrom(this.propertyType) == true) {
        this.type = TableAttributeType.LONG;
    } else if (Short.class.isAssignableFrom(this.propertyType) == true
            || Short.TYPE.isAssignableFrom(this.propertyType) == true) {
        this.type = TableAttributeType.SHORT;
    } else if (String.class.isAssignableFrom(this.propertyType) == true || this.propertyType.isEnum() == true) {
        this.type = TableAttributeType.VARCHAR;
    } else if (BigDecimal.class.isAssignableFrom(this.propertyType) == true) {
        this.type = TableAttributeType.DECIMAL;
    } else if (java.sql.Date.class.isAssignableFrom(this.propertyType) == true) {
        this.type = TableAttributeType.DATE;
    } else if (java.util.Date.class.isAssignableFrom(this.propertyType) == true) {
        this.type = TableAttributeType.TIMESTAMP;
    } else if (java.util.Locale.class.isAssignableFrom(this.propertyType) == true) {
        this.type = TableAttributeType.LOCALE;
    } else if (java.util.List.class.isAssignableFrom(this.propertyType) == true) {
        this.type = TableAttributeType.LIST;
        this.setGenericReturnType(getterMethod);
    } else if (java.util.Set.class.isAssignableFrom(this.propertyType) == true) {
        this.type = TableAttributeType.SET;
        this.setGenericReturnType(getterMethod);
        // } else if (typePropertyPresent == true && "binary".equals(typePropertyValue) == true) {
        // type = TableAttributeType.BINARY;
    } else {
        final Entity entity = this.propertyType.getAnnotation(Entity.class);
        if (entity != null) {
            final javax.persistence.Table table = this.propertyType
                    .getAnnotation(javax.persistence.Table.class);
            if (table != null) {
                this.foreignTable = table.name();
            } else {
                this.foreignTable = new Table(this.propertyType).getName();
            }
            // if (entity != null && table != null && StringUtils.isNotEmpty(table.name()) == true) {
            final String idProperty = JPAHelper.getIdProperty(this.propertyType);
            if (idProperty == null) {
                log.info("Id property not found for class '" + this.propertyType + "'): " + clazz + "."
                        + property);
            }
            this.foreignAttribute = idProperty;
            final Column column = JPAHelper.getColumnAnnotation(this.propertyType, idProperty);
            if (column != null && StringUtils.isNotEmpty(column.name()) == true) {
                this.foreignAttribute = column.name();
            }
        } else {
            log.info("Unsupported property (@Entity expected for the destination class '" + this.propertyType
                    + "'): " + clazz + "." + property);
        }
        this.type = TableAttributeType.INT;
    }
    this.annotations = JPAHelper.getPersistenceAnnotations(getterMethod);
    final Id id = JPAHelper.getIdAnnotation(clazz, property);
    if (id != null) {
        this.primaryKey = true;
        this.nullable = false;
    }
    if (primitive == true) {
        this.nullable = false;
    }
    final Column column = JPAHelper.getColumnAnnotation(clazz, property);
    if (column != null) {
        if (this.isPrimaryKey() == false && primitive == false) {
            this.nullable = column.nullable();
        }
        if (StringUtils.isNotEmpty(column.name()) == true) {
            this.name = column.name();
        }
        if (this.type.isIn(TableAttributeType.VARCHAR, TableAttributeType.CHAR) == true) {
            this.length = column.length();
        }
        if (this.type == TableAttributeType.DECIMAL) {
            this.precision = column.precision();
            this.scale = column.scale();
        }
        this.unique = column.unique();
    }
    if (this.type == TableAttributeType.DECIMAL && this.scale == 0 && this.precision == 0) {
        throw new UnsupportedOperationException(
                "Decimal values should have a precision and scale definition: " + clazz + "." + property);
    }
    final JoinColumn joinColumn = JPAHelper.getJoinColumnAnnotation(clazz, property);
    if (joinColumn != null) {
        if (StringUtils.isNotEmpty(joinColumn.name()) == true) {
            this.name = joinColumn.name();
        }
        if (joinColumn.nullable() == false) {
            this.nullable = false;
        }
    }
}

From source file:candr.yoclip.option.OptionSetter.java

@Override
public void setOption(final T bean, final String value) {

    final Class<?> setterParameterType = getType();
    try {/*from w ww.ja  va  2s  . c  o  m*/

        if (Boolean.TYPE.equals(setterParameterType) || Boolean.class.isAssignableFrom(setterParameterType)) {
            setBooleanOption(bean, value);

        } else if (Byte.TYPE.equals(setterParameterType) || Byte.class.isAssignableFrom(setterParameterType)) {
            setByteOption(bean, value);

        } else if (Short.TYPE.equals(setterParameterType)
                || Short.class.isAssignableFrom(setterParameterType)) {
            setShortOption(bean, value);

        } else if (Integer.TYPE.equals(setterParameterType)
                || Integer.class.isAssignableFrom(setterParameterType)) {
            setIntegerOption(bean, value);

        } else if (Long.TYPE.equals(setterParameterType) || Long.class.isAssignableFrom(setterParameterType)) {
            setLongOption(bean, value);

        } else if (Character.TYPE.equals(setterParameterType)
                || Character.class.isAssignableFrom(setterParameterType)) {
            setCharacterOption(bean, value);

        } else if (Float.TYPE.equals(setterParameterType)
                || Float.class.isAssignableFrom(setterParameterType)) {
            setFloatOption(bean, value);

        } else if (Double.TYPE.equals(setterParameterType)
                || Double.class.isAssignableFrom(setterParameterType)) {
            setDoubleOption(bean, value);

        } else if (String.class.isAssignableFrom(setterParameterType)) {
            setStringOption(bean, value);

        } else {
            final String supportedTypes = "boolean, byte, short, int, long, char, float, double, and String";
            throw new OptionsParseException(
                    String.format("OptionParameter only supports %s types", supportedTypes));
        }

    } catch (NumberFormatException e) {
        final String error = String.format("Error converting '%s' to %s", value, setterParameterType);
        throw new OptionsParseException(error, e);
    }
}