io.activej.etcd.codec.value.EtcdValueCodec Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of activej-etcd Show documentation
Show all versions of activej-etcd Show documentation
Etcd Codecs, and transactional support for ActiveJ project.
The newest version!
package io.activej.etcd.codec.value;
import io.activej.etcd.exception.MalformedEtcdDataException;
import io.etcd.jetcd.ByteSequence;
public interface EtcdValueCodec extends EtcdValueEncoder, EtcdValueDecoder {
static EtcdValueCodec of(EtcdValueEncoder encoder, EtcdValueDecoder decoder) {
return new EtcdValueCodec<>() {
@Override
public ByteSequence encodeValue(V value) {
return encoder.encodeValue(value);
}
@Override
public V decodeValue(ByteSequence byteSequence) throws MalformedEtcdDataException {
return decoder.decodeValue(byteSequence);
}
};
}
}