All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.lontime.extredisson.common.CodecKind Maven / Gradle / Ivy

The newest version!
package com.github.lontime.extredisson.common;

import com.github.lontime.shaded.org.redisson.client.codec.ByteArrayCodec;
import com.github.lontime.shaded.org.redisson.client.codec.Codec;
import com.github.lontime.shaded.org.redisson.client.codec.StringCodec;
import com.github.lontime.shaded.org.redisson.codec.AvroJacksonCodec;
import com.github.lontime.shaded.org.redisson.codec.CborJacksonCodec;
import com.github.lontime.shaded.org.redisson.codec.FstCodec;
import com.github.lontime.shaded.org.redisson.codec.IonJacksonCodec;
import com.github.lontime.shaded.org.redisson.codec.JsonJacksonCodec;
import com.github.lontime.shaded.org.redisson.codec.Kryo5Codec;
import com.github.lontime.shaded.org.redisson.codec.KryoCodec;
import com.github.lontime.shaded.org.redisson.codec.LZ4Codec;
import com.github.lontime.shaded.org.redisson.codec.MarshallingCodec;
import com.github.lontime.shaded.org.redisson.codec.MsgPackJacksonCodec;
import com.github.lontime.shaded.org.redisson.codec.SerializationCodec;
import com.github.lontime.shaded.org.redisson.codec.SmileJacksonCodec;
import com.github.lontime.shaded.org.redisson.codec.SnappyCodec;
import com.github.lontime.shaded.org.redisson.codec.SnappyCodecV2;

/**
 * Codec.
 * @author lontime
 * @since 1.0
 */
public enum CodecKind {

    /**
     * JACKSON.
     */
    JACKSON,
    /**
     * AVRO.
     */
    AVRO,
    /**
     * STRING.
     */
    STRING,
    /**
     * BYTES.
     */
    BYTES,
//    BITSET(BitSetCodec.INSTANCE),
//    LONG(LongCodec.INSTANCE),
//    DOUBLE(DoubleCodec.INSTANCE),
//    INTEGER(IntegerCodec.INSTANCE),
    /**
     * FST.
     */
    FST,
    /**
     * MARSHALLING.
     */
    MARSHALLING,
    /**
     * KRYO5.
     */
    KRYO5,
    /**
     * KRYO.
     */
    KRYO,
    /**
     * LZ4.
     */
    LZ4,
    /**
     * SMILE.
     */
    SMILE,
    /**
     * CBOR.
     */
    CBOR,
    /**
     * MSGPACK.
     */
    MSGPACK,
    /**
     * JDK.
     */
    ION,
    /**
     * JDK.
     */
    JDK,
    /**
     * SNAPPY.
     */
    SNAPPY,
    /**
     * SNAPPYV2.
     */
    SNAPPYV2;

    public Codec toCodec() {
        switch (this) {
            case JACKSON:
                return JsonJacksonCodec.INSTANCE;
            case AVRO:
                return new AvroJacksonCodec(CodecKind.class.getClassLoader());
            case BYTES:
                return ByteArrayCodec.INSTANCE;
            case FST:
                return new FstCodec();
            case MARSHALLING:
                return new MarshallingCodec();
            case KRYO5:
                return new Kryo5Codec();
            case KRYO:
                return new KryoCodec();
            case LZ4:
                return new LZ4Codec();
            case SMILE:
                return new SmileJacksonCodec();
            case CBOR:
                return new CborJacksonCodec();
            case MSGPACK:
                return new MsgPackJacksonCodec();
            case ION:
                return new IonJacksonCodec();
            case JDK:
                return new SerializationCodec();
            case SNAPPY:
            case SNAPPYV2:
                return new SnappyCodecV2();
            default:
                return StringCodec.INSTANCE;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy