public static Criteria createCriteriaFromClass(String name, Class<?> cls, Operator operator,  List<?> values) {

        if (operator == Operator.AND) {
            return new Group.And(cls, values);
        } else if (operator == Operator.OR) {

            return new Group.Or(cls, values);
        } else {
            FieldAccess fieldAccess = BeanUtils.idxField(cls, name);
            return createCriteria(name, operator, fieldAccess.typeEnum(), (Class<Object>) fieldAccess.type(), values);
        }
    }
public static Criteria createCriteriaFromClass(String name, Class<?> cls, Operator operator,  List<?> values) {

        if (operator == Operator.AND) {
            return new Group.And(cls, values);
        } else if (operator == Operator.OR) {

            return new Group.Or(cls, values);
        } else {
            FieldAccess fieldAccess = BeanUtils.idxField(cls, name);
            return createCriteria(name, operator, fieldAccess.typeEnum(), (Class<Object>) fieldAccess.type(), values);
        }
    }
public static Criteria createCriteriaFromClass ( String name , Class < ? > cls , Operator operator , List < ? > values ) { if ( operator == Operator . AND ) { return new Group . And ( cls , values ) ; } else if ( operator == Operator . OR ) { return new Group . Or ( cls , values ) ; } else { FieldAccess fieldAccess = BeanUtils . idxField ( cls , name ) ; return createCriteria ( name , operator , fieldAccess . typeEnum ( ) , ( Class < Object > ) fieldAccess . type ( ) , values ) ; } }
Make criteria configurable
@param operator
@param values
@return
Make criteria configurable