FROM - sourceTypeTO - targetType compatible with Cassandrapublic interface Codec<FROM,TO>
public class LongToString implements Codec<Long,String> {
@Override
public Class sourceType() {
return Long.class;
}
@Override
public Class targetType() {
return String.class;
}
@Override
public String encode(Long fromJava) throws AchillesTranscodingException {
return fromJava.toString();
}
@Override
public Long decode(String fromCassandra) throws AchillesTranscodingException {
return Long.parseLong(fromCassandra);
}
}
| Modifier and Type | Method and Description |
|---|---|
FROM |
decode(TO fromCassandra) |
TO |
encode(FROM fromJava) |
Class<FROM> |
sourceType() |
Class<TO> |
targetType() |
TO encode(FROM fromJava) throws AchillesTranscodingException
AchillesTranscodingExceptionFROM decode(TO fromCassandra) throws AchillesTranscodingException
AchillesTranscodingExceptionCopyright © 2012-2021. All Rights Reserved.