Package org.constretto.exception

Examples of org.constretto.exception.ConstrettoConversionException


    public Long fromString(String value) throws ConstrettoConversionException {
        try {
            return Long.decode(value);
        } catch (NumberFormatException e) {
            throw new ConstrettoConversionException(value, Long.class, e);
        }
    }
View Full Code Here


    public URI fromString(String value) throws ConstrettoConversionException {
        try {
            return new URI(value);
        } catch (URISyntaxException e) {
            throw new ConstrettoConversionException(value, URL.class, e.getMessage());
        }
    }
View Full Code Here

    public Short fromString(String value) throws ConstrettoConversionException {
        try {
            return Short.parseShort(value);
        } catch (NumberFormatException e) {
            throw new ConstrettoConversionException(value, Short.class, e);
        }
    }
View Full Code Here

                String name = convertPrimitive(String.class, (CPrimitive) data.get("name"));
                Integer age = convertPrimitive(Integer.class, (CPrimitive) data.get("age"));
                return new Person(name, age);

            } else {
                throw new ConstrettoConversionException(value.toString(), Person.class, "Exptected Json Object but found: " + value.getClass().getSimpleName());
            }
        }
View Full Code Here

TOP

Related Classes of org.constretto.exception.ConstrettoConversionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.