com.jk.data.dynamic.query.FieldCondition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jk-framework-data Show documentation
Show all versions of jk-framework-data Show documentation
This contains a set of API's that ease the database programming with Java, in both: JDBC and JPA Persisitnce).
/*
* Copyright 2002-2022 Dr. Jalal Kiswani.
* Email: [email protected]
* Check out https://smart-api.com for more details
*
* All the opensource projects of Dr. Jalal Kiswani are free for personal and academic use only,
* for commercial usage and support, please contact the author.
*
* 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.jk.data.dynamic.query;
import com.jk.core.util.JK;
// TODO: Auto-generated Javadoc
/**
* The Class FieldCondition.
*/
public class FieldCondition implements Condition {
/** The field name. */
String fieldName;
/** The operator. */
Operator operator = Operator.EQUAL;
/** The value. */
Object value;
/**
* Instantiates a new field condition.
*/
public FieldCondition() {
}
/**
* Instantiates a new field condition.
*
* @param fieldMetadata the field metadata
* @param value the value
*/
public FieldCondition(final Object fieldMetadata, final Object value) {
// setFieldName(fieldMetadata.getFullQualifiedName());
// setValue(value);
JK.implementMe();
}
/**
* Gets the field name.
*
* @return the field name
*/
public String getFieldName() {
return this.fieldName;
}
/**
* Gets the operator.
*
* @return the operator
*/
public Operator getOperator() {
return this.operator;
}
/**
* Gets the value.
*
* @return the value
*/
public Object getValue() {
return this.value;
}
/**
* Checks if is inline.
*
* @return true, if is inline
*/
/*
* (non-Javadoc)
*
* @see com.jk.metadata.db.query.QueryComponent#isInline()
*/
@Override
public boolean isInline() {
return false;
}
/**
* Sets the field name.
*
* @param fieldName the new field name
*/
public void setFieldName(final String fieldName) {
this.fieldName = fieldName;
}
/**
* Sets the operator.
*
* @param operator the new operator
*/
public void setOperator(final Operator operator) {
this.operator = operator;
}
/**
* Sets the value.
*
* @param value the new value
*/
public void setValue(final Object value) {
this.value = value;
}
/**
* To query element.
*
* @return the object
*/
/*
* (non-Javadoc)
*
* @see com.jk.metadata.db.query.QueryComponent#toQueryElement()
*/
@Override
public Object toQueryElement() {
return getFieldName() + getOperator().toQueryElement() + getValue().toString();
}
}