private static Object toJavaObject()

in src/main/java/org/apache/sling/servlets/post/impl/helper/SlingPropertyValueHandler.java [511:525]


    private static Object toJavaObject(final String value, final int type) {
        final boolean isEmpty = value == null || value.trim().length() == 0;
        switch (type) {
            case PropertyType.DECIMAL:
                return isEmpty ? BigDecimal.ZERO : new BigDecimal(value);
            case PropertyType.BOOLEAN:
                return isEmpty ? Boolean.FALSE : Boolean.valueOf(value);
            case PropertyType.DOUBLE:
                return isEmpty ? (double) 0.0 : Double.valueOf(value);
            case PropertyType.LONG:
                return isEmpty ? 0 : Long.valueOf(value);
            default: // fallback
                return value;
        }
    }