class EnumSetOutput<K, V, E extends Enum<E>> extends CommandOutput<K, V, Set<E>> {

    private boolean initialized;

    private final Class<E> enumClass;

    private final UnaryOperator<String> enumValuePreprocessor;

    private final Function<String, E> onUnknownValue;

    /**
     * Create a new {@link EnumSetOutput}.
     *
     * @param codec Codec used to encode/decode keys and values, must not be {@code null}.
     * @param enumClass {@link Enum} type.
     * @param enumValuePreprocessor pre-processor for {@link String} values before looking up the enum value.
     * @param onUnknownValue fallback {@link Function} to be called when an enum value cannot be looked up.
     */
    public EnumSetOutput(RedisCodec<K, V> codec, Class<E> enumClass, UnaryOperator<String> enumValuePreprocessor,
            Function<String, E> onUnknownValue) {
        super(codec, Collections.emptySet());
        this.enumClass = enumClass;
        this.enumValuePreprocessor = enumValuePreprocessor;
        this.onUnknownValue = onUnknownValue;
    }

    @Override
    public void set(ByteBuffer bytes) {

        if (bytes == null) {
            return;
        }

        E enumConstant = resolve(enumValuePreprocessor.apply(decodeAscii(bytes)));

        if (enumConstant == null) {
            return;
        }

        output.add(enumConstant);
    }

    @Override
    public void multi(int count) {

        if (!initialized) {
            output = EnumSet.noneOf(enumClass);
            initialized = true;
        }
    }

    private E resolve(String value) {<FILL_FUNCTION_BODY>}

}

        try {
            return Enum.valueOf(enumClass, value);
        } catch (IllegalArgumentException e) {
            return onUnknownValue.apply(value);
        }
    
<methods>public void <init>(RedisCodec<K,V>, Set<E>) ,public void complete(int) ,public Set<E> get() ,public java.lang.String getError() ,public boolean hasError() ,public void multi(int) ,public void multiArray(int) ,public void multiMap(int) ,public void multiPush(int) ,public void multiSet(int) ,public void set(java.nio.ByteBuffer) ,public void set(long) ,public void set(double) ,public void set(boolean) ,public void setBigNumber(java.nio.ByteBuffer) ,public void setError(java.nio.ByteBuffer) ,public void setError(java.lang.String) ,public void setSingle(java.nio.ByteBuffer) ,public java.lang.String toString() <variables>protected final non-sealed RedisCodec<K,V> codec,protected java.lang.String error,protected Set<E> output