com.fs.commons.dao.sql.query.FieldCondition Maven / Gradle / Ivy
/*
* Copyright 2002-2016 Jalal Kiswani.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.fs.commons.dao.sql.query;
import com.fs.commons.dao.dynamic.meta.FieldMeta;
public class FieldCondition implements Condition {
String fieldName;
Operator operator = Operator.EQUAL;
Object value;
public FieldCondition() {
}
public FieldCondition(final FieldMeta fieldMeta, final Object value) {
setFieldName(fieldMeta.getFullQualifiedName());
setValue(value);
}
public String getFieldName() {
return this.fieldName;
}
public Operator getOperator() {
return this.operator;
}
public Object getValue() {
return this.value;
}
@Override
public boolean isInline() {
return false;
}
public void setFieldName(final String fieldName) {
this.fieldName = fieldName;
}
public void setOperator(final Operator operator) {
this.operator = operator;
}
public void setValue(final Object value) {
this.value = value;
}
@Override
public Object toQueryElement() {
return getFieldName() + getOperator().toQueryElement() + getValue().toString();
}
}