boon/src/main/java/org/boon/criteria/ObjectFilter.java
public static Criteria createCriteria(String name, Operator operator, TypeType type, Class<Object> classType, List<?> values) {

        okOrDie("Values must be passed", values);

        Object value = values.get(0);

        switch (operator) {
            case EQUAL:
                switch (type){
                    case CHAR:
                        return eqChar(name, Conversions.toChar(value));

                    case BYTE:
                        return eqByte(name, Conversions.toByte(value));
                    case BOOLEAN:
                        return eqBoolean(name, Conversions.toBoolean(value));
                    case INT:
                        return eqInt(name, Conversions.toInt(value));
                    case FLOAT:
                        return eqFloat(name, Conversions.toFloat(value));
                    case SHORT:
                        return eqShort(name, Conversions.toShort(value));
                    case DOUBLE:
                        return eqDouble(name, Conversions.toDouble(value));
                    case LONG:
                        return eqLong(name, Conversions.toLong(value));

                    default:
                        return eq(name, Conversions.coerce(classType, value));
                }
            case NOT_EQUAL:
                switch (type){
                    case CHAR:
                        return notEqChar(name, Conversions.toChar(value));
                    case BYTE:
                        return notEqByte(name, Conversions.toByte(value));
                    case BOOLEAN:
                        return notEqBoolean(name, Conversions.toBoolean(value));
                    case INT:
                        return notEqInt(name, Conversions.toInt(value));
                    case FLOAT:
                        return notEqFloat(name, Conversions.toFloat(value));
                    case SHORT:
                        return notEqShort(name, Conversions.toShort(value));
                    case DOUBLE:
                        return notEqDouble(name, Conversions.toDouble(value));
                    case LONG:
                        return notEqLong(name, Conversions.toLong(value));

                    default:
                        return notEq(name, Conversions.coerce(classType, value));
                }
            case GREATER_THAN:
                switch (type){
                    case CHAR:
                        return gtChar(name, Conversions.toChar(value));
                    case BYTE:
                        return gtByte(name, Conversions.toByte(value));
                    case INT:
                        return gtInt(name, Conversions.toInt(value));
                    case FLOAT:
                        return gtFloat(name, Conversions.toFloat(value));
                    case SHORT:
                        return gtShort(name, Conversions.toShort(value));
                    case DOUBLE:
                        return gtDouble(name, Conversions.toDouble(value));
                    case LONG:
                        return gtLong(name, Conversions.toLong(value));

                    default:
                        return gt(name, Conversions.coerce(classType, value));
                }
            case LESS_THAN:
                switch (type){
                    case CHAR:
                        return ltChar(name, Conversions.toChar(value));
                    case BYTE:
                        return ltByte(name, Conversions.toByte(value));
                    case INT:
                        return ltInt(name, Conversions.toInt(value));
                    case FLOAT:
                        return ltFloat(name, Conversions.toFloat(value));
                    case SHORT:
                        return ltShort(name, Conversions.toShort(value));
                    case DOUBLE:
                        return ltDouble(name, Conversions.toDouble(value));
                    case LONG:
                        return ltLong(name, Conversions.toLong(value));

                    default:
                        return lt(name, Conversions.coerce(classType, value));
                }
            case GREATER_THAN_EQUAL:
                switch (type){
                    case CHAR:
                        return gteChar(name, Conversions.toChar(value));
                    case BYTE:
                        return gteByte(name, Conversions.toByte(value));
                    case INT:
                        return gteInt(name, Conversions.toInt(value));
                    case FLOAT:
                        return gteFloat(name, Conversions.toFloat(value));
                    case SHORT:
                        return gteShort(name, Conversions.toShort(value));
                    case DOUBLE:
                        return gteDouble(name, Conversions.toDouble(value));
                    case LONG:
                        return gteLong(name, Conversions.toLong(value));

                    default:
                        return gte(name, Conversions.coerce(classType, value));
                }
            case LESS_THAN_EQUAL:
                switch (type){
                    case CHAR:
                        return lteChar(name, Conversions.toChar(value));
                    case BYTE:
                        return lteByte(name, Conversions.toByte(value));
                    case INT:
                        return lteInt(name, Conversions.toInt(value));
                    case FLOAT:
                        return lteFloat(name, Conversions.toFloat(value));
                    case SHORT:
                        return lteShort(name, Conversions.toShort(value));
                    case DOUBLE:
                        return lteDouble(name, Conversions.toDouble(value));
                    case LONG:
                        return lteLong(name, Conversions.toLong(value));

                    default:
                        return lte(name, Conversions.coerce(classType, value));
                }

            case BETWEEN:

                okOrDie("Values must be at least 2 in size", values.size()>1);
                Object value2 = values.get(1);
                switch (type){
                    case CHAR:
                        return betweenChar(name, Conversions.toChar(value),
                                Conversions.toChar(value2));
                    case BYTE:
                        return betweenByte(name, Conversions.toByte(value),
                                Conversions.toByte(value2));
                    case INT:
                        return betweenInt(name, Conversions.toInt(value),
                                Conversions.toInt(value2));
                    case FLOAT:
                        return betweenFloat(name, Conversions.toFloat(value),
                                Conversions.toFloat(value2));
                    case SHORT:
                        return betweenShort(name, Conversions.toShort(value),
                                Conversions.toShort(value2));
                    case DOUBLE:
                        return betweenDouble(name, Conversions.toDouble(value),
                                Conversions.toDouble(value2));
                    case LONG:
                        return betweenLong(name, Conversions.toLong(value),
                                Conversions.toLong(value2));

                    default:
                        return between(name, Conversions.coerce(classType, value), Conversions.coerce(classType, value2));
                }
            case IN:

                switch (type){
                    case CHAR:
                        return inChars(name, Conversions.carray(values));
                    case BYTE:
                        return inBytes(name, Conversions.barray(values));
                    case INT:
                        return inInts(name, Conversions.iarray(values));
                    case FLOAT:
                        return inFloats(name, Conversions.farray(values));
                    case SHORT:
                        return inShorts(name, Conversions.sarray(values));
                    case DOUBLE:
                        return inDoubles(name, Conversions.darray(values));
                    case LONG:
                        return inLongs(name, Conversions.larray(values));

                    default:
                        return in(name, Conversions.toArray(classType, (List<Object>)values));
                }
            case NOT_IN:

                switch (type){
                    case CHAR:
                        return notInChars(name, Conversions.carray(values));
                    case BYTE:
                        return notInBytes(name, Conversions.barray(values));
                    case INT:
                        return notInInts(name, Conversions.iarray(values));
                    case FLOAT:
                        return notInFloats(name, Conversions.farray(values));
                    case SHORT:
                        return notInShorts(name, Conversions.sarray(values));
                    case DOUBLE:
                        return notInDoubles(name, Conversions.darray(values));
                    case LONG:
                        return notInLongs(name, Conversions.larray(values));

                    default:
                        return notIn(name, Conversions.toArray(classType, (List<Object>) values));
                }

            case CONTAINS:
                return contains(name, Conversions.coerce(classType, value));

            case NOT_CONTAINS:
                return notContains(name, Conversions.coerce(classType, value));


            case STARTS_WITH:
                return startsWith(name, value);

            case ENDS_WITH:
                return endsWith(name, value);

            case NOT_EMPTY:
                return notEmpty(name);

            case IS_EMPTY:
                return empty(name);



        }



        return die(Criteria.class, "Not Found", name, operator, type, values);
    }
public static Criteria createCriteria(String name, Operator operator, TypeType type, Class<Object> classType, List<?> values) {

        okOrDie("Values must be passed", values);

        Object value = values.get(0);

        switch (operator) {
            case EQUAL:
                switch (type){
                    case CHAR:
                        return eqChar(name, Conversions.toChar(value));

                    case BYTE:
                        return eqByte(name, Conversions.toByte(value));
                    case BOOLEAN:
                        return eqBoolean(name, Conversions.toBoolean(value));
                    case INT:
                        return eqInt(name, Conversions.toInt(value));
                    case FLOAT:
                        return eqFloat(name, Conversions.toFloat(value));
                    case SHORT:
                        return eqShort(name, Conversions.toShort(value));
                    case DOUBLE:
                        return eqDouble(name, Conversions.toDouble(value));
                    case LONG:
                        return eqLong(name, Conversions.toLong(value));

                    default:
                        return eq(name, Conversions.coerce(classType, value));
                }
            case NOT_EQUAL:
                switch (type){
                    case CHAR:
                        return notEqChar(name, Conversions.toChar(value));
                    case BYTE:
                        return notEqByte(name, Conversions.toByte(value));
                    case BOOLEAN:
                        return notEqBoolean(name, Conversions.toBoolean(value));
                    case INT:
                        return notEqInt(name, Conversions.toInt(value));
                    case FLOAT:
                        return notEqFloat(name, Conversions.toFloat(value));
                    case SHORT:
                        return notEqShort(name, Conversions.toShort(value));
                    case DOUBLE:
                        return notEqDouble(name, Conversions.toDouble(value));
                    case LONG:
                        return notEqLong(name, Conversions.toLong(value));

                    default:
                        return notEq(name, Conversions.coerce(classType, value));
                }
            case GREATER_THAN:
                switch (type){
                    case CHAR:
                        return gtChar(name, Conversions.toChar(value));
                    case BYTE:
                        return gtByte(name, Conversions.toByte(value));
                    case INT:
                        return gtInt(name, Conversions.toInt(value));
                    case FLOAT:
                        return gtFloat(name, Conversions.toFloat(value));
                    case SHORT:
                        return gtShort(name, Conversions.toShort(value));
                    case DOUBLE:
                        return gtDouble(name, Conversions.toDouble(value));
                    case LONG:
                        return gtLong(name, Conversions.toLong(value));

                    default:
                        return gt(name, Conversions.coerce(classType, value));
                }
            case LESS_THAN:
                switch (type){
                    case CHAR:
                        return ltChar(name, Conversions.toChar(value));
                    case BYTE:
                        return ltByte(name, Conversions.toByte(value));
                    case INT:
                        return ltInt(name, Conversions.toInt(value));
                    case FLOAT:
                        return ltFloat(name, Conversions.toFloat(value));
                    case SHORT:
                        return ltShort(name, Conversions.toShort(value));
                    case DOUBLE:
                        return ltDouble(name, Conversions.toDouble(value));
                    case LONG:
                        return ltLong(name, Conversions.toLong(value));

                    default:
                        return lt(name, Conversions.coerce(classType, value));
                }
            case GREATER_THAN_EQUAL:
                switch (type){
                    case CHAR:
                        return gteChar(name, Conversions.toChar(value));
                    case BYTE:
                        return gteByte(name, Conversions.toByte(value));
                    case INT:
                        return gteInt(name, Conversions.toInt(value));
                    case FLOAT:
                        return gteFloat(name, Conversions.toFloat(value));
                    case SHORT:
                        return gteShort(name, Conversions.toShort(value));
                    case DOUBLE:
                        return gteDouble(name, Conversions.toDouble(value));
                    case LONG:
                        return gteLong(name, Conversions.toLong(value));

                    default:
                        return gte(name, Conversions.coerce(classType, value));
                }
            case LESS_THAN_EQUAL:
                switch (type){
                    case CHAR:
                        return lteChar(name, Conversions.toChar(value));
                    case BYTE:
                        return lteByte(name, Conversions.toByte(value));
                    case INT:
                        return lteInt(name, Conversions.toInt(value));
                    case FLOAT:
                        return lteFloat(name, Conversions.toFloat(value));
                    case SHORT:
                        return lteShort(name, Conversions.toShort(value));
                    case DOUBLE:
                        return lteDouble(name, Conversions.toDouble(value));
                    case LONG:
                        return lteLong(name, Conversions.toLong(value));

                    default:
                        return lte(name, Conversions.coerce(classType, value));
                }

            case BETWEEN:

                okOrDie("Values must be at least 2 in size", values.size()>1);
                Object value2 = values.get(1);
                switch (type){
                    case CHAR:
                        return betweenChar(name, Conversions.toChar(value),
                                Conversions.toChar(value2));
                    case BYTE:
                        return betweenByte(name, Conversions.toByte(value),
                                Conversions.toByte(value2));
                    case INT:
                        return betweenInt(name, Conversions.toInt(value),
                                Conversions.toInt(value2));
                    case FLOAT:
                        return betweenFloat(name, Conversions.toFloat(value),
                                Conversions.toFloat(value2));
                    case SHORT:
                        return betweenShort(name, Conversions.toShort(value),
                                Conversions.toShort(value2));
                    case DOUBLE:
                        return betweenDouble(name, Conversions.toDouble(value),
                                Conversions.toDouble(value2));
                    case LONG:
                        return betweenLong(name, Conversions.toLong(value),
                                Conversions.toLong(value2));

                    default:
                        return between(name, Conversions.coerce(classType, value), Conversions.coerce(classType, value2));
                }
            case IN:

                switch (type){
                    case CHAR:
                        return inChars(name, Conversions.carray(values));
                    case BYTE:
                        return inBytes(name, Conversions.barray(values));
                    case INT:
                        return inInts(name, Conversions.iarray(values));
                    case FLOAT:
                        return inFloats(name, Conversions.farray(values));
                    case SHORT:
                        return inShorts(name, Conversions.sarray(values));
                    case DOUBLE:
                        return inDoubles(name, Conversions.darray(values));
                    case LONG:
                        return inLongs(name, Conversions.larray(values));

                    default:
                        return in(name, Conversions.toArray(classType, (List<Object>)values));
                }
            case NOT_IN:

                switch (type){
                    case CHAR:
                        return notInChars(name, Conversions.carray(values));
                    case BYTE:
                        return notInBytes(name, Conversions.barray(values));
                    case INT:
                        return notInInts(name, Conversions.iarray(values));
                    case FLOAT:
                        return notInFloats(name, Conversions.farray(values));
                    case SHORT:
                        return notInShorts(name, Conversions.sarray(values));
                    case DOUBLE:
                        return notInDoubles(name, Conversions.darray(values));
                    case LONG:
                        return notInLongs(name, Conversions.larray(values));

                    default:
                        return notIn(name, Conversions.toArray(classType, (List<Object>) values));
                }

            case CONTAINS:
                return contains(name, Conversions.coerce(classType, value));

            case NOT_CONTAINS:
                return notContains(name, Conversions.coerce(classType, value));


            case STARTS_WITH:
                return startsWith(name, value);

            case ENDS_WITH:
                return endsWith(name, value);

            case NOT_EMPTY:
                return notEmpty(name);

            case IS_EMPTY:
                return empty(name);



        }



        return die(Criteria.class, "Not Found", name, operator, type, values);
    }
public static Criteria createCriteria ( String name , Operator operator , TypeType type , Class < Object > classType , List < ? > values ) { okOrDie ( "Values must be passed" , values ) ; Object value = values . get ( 0 ) ; switch ( operator ) { case EQUAL : switch ( type ) { case CHAR : return eqChar ( name , Conversions . toChar ( value ) ) ; case BYTE : return eqByte ( name , Conversions . toByte ( value ) ) ; case BOOLEAN : return eqBoolean ( name , Conversions . toBoolean ( value ) ) ; case INT : return eqInt ( name , Conversions . toInt ( value ) ) ; case FLOAT : return eqFloat ( name , Conversions . toFloat ( value ) ) ; case SHORT : return eqShort ( name , Conversions . toShort ( value ) ) ; case DOUBLE : return eqDouble ( name , Conversions . toDouble ( value ) ) ; case LONG : return eqLong ( name , Conversions . toLong ( value ) ) ; default : return eq ( name , Conversions . coerce ( classType , value ) ) ; } case NOT_EQUAL : switch ( type ) { case CHAR : return notEqChar ( name , Conversions . toChar ( value ) ) ; case BYTE : return notEqByte ( name , Conversions . toByte ( value ) ) ; case BOOLEAN : return notEqBoolean ( name , Conversions . toBoolean ( value ) ) ; case INT : return notEqInt ( name , Conversions . toInt ( value ) ) ; case FLOAT : return notEqFloat ( name , Conversions . toFloat ( value ) ) ; case SHORT : return notEqShort ( name , Conversions . toShort ( value ) ) ; case DOUBLE : return notEqDouble ( name , Conversions . toDouble ( value ) ) ; case LONG : return notEqLong ( name , Conversions . toLong ( value ) ) ; default : return notEq ( name , Conversions . coerce ( classType , value ) ) ; } case GREATER_THAN : switch ( type ) { case CHAR : return gtChar ( name , Conversions . toChar ( value ) ) ; case BYTE : return gtByte ( name , Conversions . toByte ( value ) ) ; case INT : return gtInt ( name , Conversions . toInt ( value ) ) ; case FLOAT : return gtFloat ( name , Conversions . toFloat ( value ) ) ; case SHORT : return gtShort ( name , Conversions . toShort ( value ) ) ; case DOUBLE : return gtDouble ( name , Conversions . toDouble ( value ) ) ; case LONG : return gtLong ( name , Conversions . toLong ( value ) ) ; default : return gt ( name , Conversions . coerce ( classType , value ) ) ; } case LESS_THAN : switch ( type ) { case CHAR : return ltChar ( name , Conversions . toChar ( value ) ) ; case BYTE : return ltByte ( name , Conversions . toByte ( value ) ) ; case INT : return ltInt ( name , Conversions . toInt ( value ) ) ; case FLOAT : return ltFloat ( name , Conversions . toFloat ( value ) ) ; case SHORT : return ltShort ( name , Conversions . toShort ( value ) ) ; case DOUBLE : return ltDouble ( name , Conversions . toDouble ( value ) ) ; case LONG : return ltLong ( name , Conversions . toLong ( value ) ) ; default : return lt ( name , Conversions . coerce ( classType , value ) ) ; } case GREATER_THAN_EQUAL : switch ( type ) { case CHAR : return gteChar ( name , Conversions . toChar ( value ) ) ; case BYTE : return gteByte ( name , Conversions . toByte ( value ) ) ; case INT : return gteInt ( name , Conversions . toInt ( value ) ) ; case FLOAT : return gteFloat ( name , Conversions . toFloat ( value ) ) ; case SHORT : return gteShort ( name , Conversions . toShort ( value ) ) ; case DOUBLE : return gteDouble ( name , Conversions . toDouble ( value ) ) ; case LONG : return gteLong ( name , Conversions . toLong ( value ) ) ; default : return gte ( name , Conversions . coerce ( classType , value ) ) ; } case LESS_THAN_EQUAL : switch ( type ) { case CHAR : return lteChar ( name , Conversions . toChar ( value ) ) ; case BYTE : return lteByte ( name , Conversions . toByte ( value ) ) ; case INT : return lteInt ( name , Conversions . toInt ( value ) ) ; case FLOAT : return lteFloat ( name , Conversions . toFloat ( value ) ) ; case SHORT : return lteShort ( name , Conversions . toShort ( value ) ) ; case DOUBLE : return lteDouble ( name , Conversions . toDouble ( value ) ) ; case LONG : return lteLong ( name , Conversions . toLong ( value ) ) ; default : return lte ( name , Conversions . coerce ( classType , value ) ) ; } case BETWEEN : okOrDie ( "Values must be at least 2 in size" , values . size ( ) > 1 ) ; Object value2 = values . get ( 1 ) ; switch ( type ) { case CHAR : return betweenChar ( name , Conversions . toChar ( value ) , Conversions . toChar ( value2 ) ) ; case BYTE : return betweenByte ( name , Conversions . toByte ( value ) , Conversions . toByte ( value2 ) ) ; case INT : return betweenInt ( name , Conversions . toInt ( value ) , Conversions . toInt ( value2 ) ) ; case FLOAT : return betweenFloat ( name , Conversions . toFloat ( value ) , Conversions . toFloat ( value2 ) ) ; case SHORT : return betweenShort ( name , Conversions . toShort ( value ) , Conversions . toShort ( value2 ) ) ; case DOUBLE : return betweenDouble ( name , Conversions . toDouble ( value ) , Conversions . toDouble ( value2 ) ) ; case LONG : return betweenLong ( name , Conversions . toLong ( value ) , Conversions . toLong ( value2 ) ) ; default : return between ( name , Conversions . coerce ( classType , value ) , Conversions . coerce ( classType , value2 ) ) ; } case IN : switch ( type ) { case CHAR : return inChars ( name , Conversions . carray ( values ) ) ; case BYTE : return inBytes ( name , Conversions . barray ( values ) ) ; case INT : return inInts ( name , Conversions . iarray ( values ) ) ; case FLOAT : return inFloats ( name , Conversions . farray ( values ) ) ; case SHORT : return inShorts ( name , Conversions . sarray ( values ) ) ; case DOUBLE : return inDoubles ( name , Conversions . darray ( values ) ) ; case LONG : return inLongs ( name , Conversions . larray ( values ) ) ; default : return in ( name , Conversions . toArray ( classType , ( List < Object > ) values ) ) ; } case NOT_IN : switch ( type ) { case CHAR : return notInChars ( name , Conversions . carray ( values ) ) ; case BYTE : return notInBytes ( name , Conversions . barray ( values ) ) ; case INT : return notInInts ( name , Conversions . iarray ( values ) ) ; case FLOAT : return notInFloats ( name , Conversions . farray ( values ) ) ; case SHORT : return notInShorts ( name , Conversions . sarray ( values ) ) ; case DOUBLE : return notInDoubles ( name , Conversions . darray ( values ) ) ; case LONG : return notInLongs ( name , Conversions . larray ( values ) ) ; default : return notIn ( name , Conversions . toArray ( classType , ( List < Object > ) values ) ) ; } case CONTAINS : return contains ( name , Conversions . coerce ( classType , value ) ) ; case NOT_CONTAINS : return notContains ( name , Conversions . coerce ( classType , value ) ) ; case STARTS_WITH : return startsWith ( name , value ) ; case ENDS_WITH : return endsWith ( name , value ) ; case NOT_EMPTY : return notEmpty ( name ) ; case IS_EMPTY : return empty ( name ) ; } return die ( Criteria . class , "Not Found" , name , operator , type , values ) ; }
Make criteria configurable
@param operator
@param type
@param values
@return
Make criteria configurable