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

com.aerospike.jdbc.predicate.QueryPredicateIsNull Maven / Gradle / Ivy

The newest version!
package com.aerospike.jdbc.predicate;

import com.aerospike.client.exp.Exp;
import com.aerospike.client.query.Filter;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

import static com.aerospike.jdbc.util.Constants.PRIMARY_KEY_COLUMN_NAME;

public class QueryPredicateIsNull implements QueryPredicate {

    private final String binName;

    public QueryPredicateIsNull(String binName) {
        this.binName = binName;
    }

    @Override
    public Exp toFilterExpression(boolean withPrimaryKey) {
        return Exp.not(
                binName.equals(PRIMARY_KEY_COLUMN_NAME)
                        ? Exp.keyExists()
                        : Exp.binExists(binName)
        );
    }

    @Override
    public Optional toFilter(String binName) {
        return Optional.empty();
    }

    @Override
    public boolean isIndexable() {
        return false;
    }

    @Override
    public List getBinNames() {
        return Collections.emptyList();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy