io.activej.etcd.codec.key.EtcdKeyCodec 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.key;
import io.activej.etcd.exception.MalformedEtcdDataException;
import io.etcd.jetcd.ByteSequence;
public interface EtcdKeyCodec extends EtcdKeyEncoder, EtcdKeyDecoder {
static EtcdKeyCodec of(EtcdKeyEncoder encoder, EtcdKeyDecoder decoder) {
return new EtcdKeyCodec<>() {
@Override
public ByteSequence encodeKey(K key) {
return encoder.encodeKey(key);
}
@Override
public K decodeKey(ByteSequence byteSequence) throws MalformedEtcdDataException {
return decoder.decodeKey(byteSequence);
}
};
}
}