public Object get()

in src/main/java/org/apache/commons/beanutils2/BasicDynaBean.java [119:160]


    public Object get(final String name) {

        // Return any non-null value for the specified property
        final Object value = values.get(name);
        if (value != null) {
            return value;
        }

        // Return a null value for a non-primitive property
        final Class<?> type = getDynaProperty(name).getType();
        if (!type.isPrimitive()) {
            return value;
        }

        // Manufacture default values for primitive properties
        if (type == Boolean.TYPE) {
            return Boolean.FALSE;
        }
        if (type == Byte.TYPE) {
            return BYTE_ZERO;
        }
        if (type == Character.TYPE) {
            return CHARACTER_ZERO;
        }
        if (type == Double.TYPE) {
            return DOUBLE_ZERO;
        }
        if (type == Float.TYPE) {
            return FLOAT_ZERO;
        }
        if (type == Integer.TYPE) {
            return INTEGER_ZERO;
        }
        if (type == Long.TYPE) {
            return LONG_ZERO;
        }
        if (type == Short.TYPE) {
            return SHORT_ZERO;
        }
        return null;

    }