Example usage for org.apache.commons.configuration Configuration getBigDecimal

List of usage examples for org.apache.commons.configuration Configuration getBigDecimal

Introduction

In this page you can find the example usage for org.apache.commons.configuration Configuration getBigDecimal.

Prototype

BigDecimal getBigDecimal(String key, BigDecimal defaultValue);

Source Link

Document

Get a BigDecimal associated with the given configuration key.

Usage

From source file:com.germinus.easyconf.ComponentProperties.java

protected static Object getTypedPropertyWithDefault(String key, Class theClass, Configuration properties,
        Object defaultValue) {/*  www. ja  v a  2s. com*/
    if (theClass.equals(Float.class)) {
        return properties.getFloat(key, (Float) defaultValue);

    } else if (theClass.equals(Integer.class)) {
        return properties.getInteger(key, (Integer) defaultValue);

    } else if (theClass.equals(String.class)) {
        return properties.getString(key, (String) defaultValue);

    } else if (theClass.equals(Double.class)) {
        return properties.getDouble(key, (Double) defaultValue);

    } else if (theClass.equals(Long.class)) {
        return properties.getLong(key, (Long) defaultValue);

    } else if (theClass.equals(Boolean.class)) {
        return properties.getBoolean(key, (Boolean) defaultValue);

    } else if (theClass.equals(List.class)) {
        return properties.getList(key, (List) defaultValue);

    } else if (theClass.equals(BigInteger.class)) {
        return properties.getBigInteger(key, (BigInteger) defaultValue);

    } else if (theClass.equals(BigDecimal.class)) {
        return properties.getBigDecimal(key, (BigDecimal) defaultValue);

    } else if (theClass.equals(Byte.class)) {
        return properties.getByte(key, (Byte) defaultValue);

    } else if (theClass.equals(Short.class)) {
        return properties.getShort(key, (Short) defaultValue);
    }
    throw new IllegalArgumentException("Class " + theClass + " is not" + "supported for properties");
}