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

org.xbib.cql.model.Facet Maven / Gradle / Ivy

There is a newer version: 1.1.1
Show newest version
package org.xbib.cql.model;

import org.xbib.cql.QueryFacet;

/**
 * Facet.
 *
 * @param  parameter type
 */
public final class Facet implements QueryFacet, Comparable> {

    private int size;
    private String filterName;
    private String name;
    private V value;

    public Facet(String name) {
        this.name = name;
    }

    public Facet(String name, String filterName, int size) {
        this.name = name;
        this.filterName = filterName;
        this.size = size;
    }

    @Override
    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public void setValue(V value) {
        this.value = value;
    }

    @Override
    public V getValue() {
        return value;
    }

    @Override
    public int getSize() {
        return size;
    }

    @Override
    public String getFilterName() {
        return filterName;
    }

    public String toCQL() {
        return CQLQueryModel.FACET_INDEX_NAME + "." + name + " = " + value;
    }

    @Override
    public int compareTo(Facet o) {
        return name.compareTo((o).getName());
    }

    @Override
    public String toString() {
        return toCQL();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy