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

com.lambdaworks.redis.output.BooleanOutput Maven / Gradle / Ivy

There is a newer version: 3.40.2
Show newest version
// Copyright (C) 2011 - Will Glozer.  All rights reserved.

package com.lambdaworks.redis.output;

import com.lambdaworks.redis.codec.RedisCodec;
import com.lambdaworks.redis.protocol.CommandOutput;

import java.nio.ByteBuffer;

/**
 * Boolean output. The actual value is returned as an integer
 * where 0 indicates false and 1 indicates true, or as a null
 * bulk reply for script output.
 *
 * @author Will Glozer
 */
public class BooleanOutput extends CommandOutput {
    public BooleanOutput(RedisCodec codec) {
        super(codec, null);
    }

    @Override
    public void set(long integer) {
        output = (integer == 1) ? Boolean.TRUE : Boolean.FALSE;
    }

    @Override
    public void set(ByteBuffer bytes) {
        output = (bytes != null) ? Boolean.TRUE : Boolean.FALSE;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy