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

org.noorm.jdbc.QueryColumn Maven / Gradle / Ivy

There is a newer version: 1.5.0
Show newest version
package org.noorm.jdbc;

/**
 * Query column definition for the generic SQL query construction.
 *
 * @author Ulf Pietruschka / [email protected]
 *         Date: 20.01.13
 *         Time: 09:37
 */
public class QueryColumn implements Comparable {

    private String columnName;
    private Operator operator;

    public QueryColumn () {
        operator = new Operator();
    }

    public QueryColumn(final String pColumnName, final Operator pOperator) {
        columnName = pColumnName;
        operator = pOperator;
    }

    public String getColumnName() {
        return columnName;
    }

    public void setColumnName(final String pColumnName) {
        columnName = pColumnName;
    }

    public Operator getOperator() {
        return operator;
    }

    public void setOperator(final Operator pOperator) {
        operator = pOperator;
    }

    @Override
    public int compareTo(final Object pQueryColumn) {
        final String thisComparatorValue = columnName + operator.getOperatorName().name();
        final QueryColumn other = (QueryColumn) pQueryColumn;
        final String otherComparatorValue = other.getColumnName() + other.getOperator().getOperatorName().name();
        return thisComparatorValue.compareTo(otherComparatorValue);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy