Examples of AchillesTranscodingException


Examples of info.archinnov.achilles.exception.AchillesTranscodingException

    public String encode(TYPE fromJava) throws AchillesTranscodingException {
        if(fromJava == null) return null;
        try {
            return objectMapper.writeValueAsString(fromJava);
        } catch (JsonProcessingException e) {
            throw new AchillesTranscodingException(e);
        }
    }
View Full Code Here

Examples of info.archinnov.achilles.exception.AchillesTranscodingException

    public TYPE decode(String fromCassandra) throws AchillesTranscodingException {
        if(fromCassandra == null) return null;
        try {
            return objectMapper.readValue(fromCassandra, sourceType);
        } catch (IOException e) {
            throw new AchillesTranscodingException(e);
        }
    }
View Full Code Here

Examples of info.archinnov.achilles.exception.AchillesTranscodingException

    @Override
    public Byte decode(ByteBuffer fromCassandra) throws AchillesTranscodingException {
        if(fromCassandra == null) return null;
        byte[] byteBuffer = readByteBuffer(fromCassandra);
        if (byteBuffer.length < 1) {
            throw new AchillesTranscodingException("Error while decoding value '" + fromCassandra + "' to type 'byte' ");
        }
        return byteBuffer[0];
    }
View Full Code Here

Examples of info.archinnov.achilles.exception.AchillesTranscodingException

    @Override
    public Integer encode(ENUM fromJava) {
        if(fromJava == null) return null;
        if (!fromJava.getClass().isEnum()) {
            throw new AchillesTranscodingException(format("Object '%s' to be encoded should be an enum", fromJava));
        }
        for (int i = 0; i < enumValues.size(); i++) {
            if (enumValues.get(i) == fromJava) {
                return i;
            }
        }
        throw new AchillesTranscodingException(format("Cannot find matching enum values for '%s' from possible enum constants '%s' ", fromJava, enumValues));
    }
View Full Code Here

Examples of info.archinnov.achilles.exception.AchillesTranscodingException

    @Override
    public ENUM decode(Integer fromCassandra) {
        if(fromCassandra == null) return null;
        if (fromCassandra > enumValues.size()-1 || fromCassandra < 0) {
            throw new AchillesTranscodingException(format("Cannot find matching enum values for '%s' from possible enum constants '%s' ", fromCassandra, enumValues));
        }
        return enumValues.get(fromCassandra);
    }
View Full Code Here

Examples of info.archinnov.achilles.exception.AchillesTranscodingException

    @Override
    public String encode(ENUM fromJava) throws AchillesTranscodingException {
        if(fromJava == null) return null;
        if (!fromJava.getClass().isEnum()) {
            throw new AchillesTranscodingException(format("Object '%s' to be encoded should be an enum", fromJava));
        }
        if (!enumValues.contains(fromJava)) {
            throw new AchillesTranscodingException(format("Cannot find matching enum values for '%s' from possible enum constants '%s' ", fromJava, enumValues));
        }
        return ((Enum<?>) fromJava).name();
    }
View Full Code Here

Examples of info.archinnov.achilles.exception.AchillesTranscodingException

    public ENUM decode(String fromCassandra) throws AchillesTranscodingException {
        if(fromCassandra == null) return null;
        for (ENUM enumValue : enumValues) {
            if(((Enum<?>)enumValue).name().equals(fromCassandra)) return enumValue;
        }
        throw new AchillesTranscodingException(format("Cannot find matching enum values for '%s' from possible enum constants '%s' ", fromCassandra, enumValues));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.