⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 searchcriteriaholder.java

📁 利用java反射机制
💻 JAVA
字号:
package org.julp;import java.util.*;public class SearchCriteriaHolder implements java.io.Serializable, Cloneable{        public SearchCriteriaHolder() {    }        protected String fieldLabel = null;    protected String fieldName = null;    protected String operator = "=";    protected String functionName = null;    protected Object searchValue = null;    protected String booleanCondition = AND;     public static final String AND = "AND";    public static final String OR = "OR";        public static final String LESS = "<";    public static final String LESS_OR_EQUALS = "<=";    public static final String EQUALS = "=";    public static final String LIKE = "LIKE";    public static final String NOT_LIKE = "NOT LIKE";    public static final String IN = "IN";    public static final String NOT_IN = "NOT IN";    public static final String NOT_EQUALS = "<>";    public static final String NOT_EXISTS = "NOT EXISTS";    public static final String EXISTS = "EXISTS";    public static final String BETWEEN = "BETWEEN";    public static final String NOT_BETWEEN = "NOT BETWEEN";    public static final String IS = "IS";    public static final String IS_NOT = "IS NOT";    public static final String GREATER_OR_EQUALS = ">=";    public static final String GREATER = ">";        protected String operators = "<=NOT LIKE!=NOT IN<>NOT EXISTSNOT BETWEEN IS NOT >=";     protected Map searchValuesMap = null;        /** Getter for property fieldName.     * @return Value of property fieldName.     *     */    public java.lang.String getFieldName() {        return fieldName;    }        /** Setter for property fieldName.     * @param fieldName New value of property fieldName.     *     */    public void setFieldName(java.lang.String fieldName) {        this.fieldName = fieldName;    }        /** Getter for property operator.     * @return Value of property operator.     *     */    public java.lang.String getOperator() {        return operator;    }        /** Setter for property operator.     * @param operator New value of property operator.     *     */    public void setOperator(java.lang.String operator) {        if (operators.indexOf(operator.toUpperCase()) == -1){            throw new IllegalArgumentException("Invalid Operator: " + operator);        }        this.operator = operator;    }        /** Getter for property functionName.     * @return Value of property functionName.     *     */    public java.lang.String getFunctionName() {        return functionName;    }        /** Setter for property functionName.     * @param functionName New value of property functionName.     *     */    public void setFunctionName(java.lang.String functionName) {        this.functionName = functionName;    }        /** Getter for property searchValue.     * @return Value of property searchValue.     *     */    public java.lang.Object getSearchValue() {        return searchValue;    }        /** Setter for property searchValue.     * @param searchValue New value of property searchValue.     *     */    public void setSearchValue(java.lang.Object searchValue) {        this.searchValue = searchValue;    }        /** Getter for property booleanCondition.     * @return Value of property booleanCondition.     *     */    public java.lang.String getBooleanCondition() {        return booleanCondition;    }        /** Setter for property booleanCondition.     * @param booleanCondition New value of property booleanCondition.     *     */    public void setBooleanCondition(java.lang.String booleanCondition) {                if (booleanCondition == null){            throw new IllegalArgumentException("Missing Boolean Condition. AND/OR must be used");        }        if (!booleanCondition.equalsIgnoreCase(AND) && !booleanCondition.equalsIgnoreCase(OR)){            throw new IllegalArgumentException("Invalid Boolean Condition: " + booleanCondition + ". Only AND/OR must be used");        }        this.booleanCondition = booleanCondition;    }           public String toString(){        StringBuffer sb = new StringBuffer();        if (functionName != null){            sb.append(functionName).append("(").append(fieldName).append(")");        }else{            sb.append(fieldName);        }                sb.append(" ").append(operator).append(" ");        sb.append(searchValue);        sb.append(" ").append(booleanCondition).append(" ");                return sb.toString();    }        /** Getter for property searchValuesMap.     * @return Value of property searchValuesMap.     *     */    public java.util.Map getSearchValuesMap() {        return searchValuesMap;    }        /** Setter for property searchValuesMap.     * @param searchValuesMap New value of property searchValuesMap.     *     */    public void setSearchValuesMap(java.util.Map searchValuesMap) {        this.searchValuesMap = searchValuesMap;    }        /** Getter for property fieldLabel.     * @return Value of property fieldLabel.     *     */    public java.lang.String getFieldLabel() {        return fieldLabel;    }        /** Setter for property fieldLabel.     * @param fieldLabel New value of property fieldLabel.     *     */    public void setFieldLabel(java.lang.String fieldLabel) {        this.fieldLabel = fieldLabel;    }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -