private static boolean compareReflective(final String val,final int comparator,final Object attr){
  final Class<?> clazz=attr.getClass();
  Object typedVal=null;
  try {
    final Constructor<?> constr=clazz.getConstructor(String.class);
    typedVal=constr.newInstance(new Object[]{val});
    if (attr instanceof Comparable) {
      return compareTyped(typedVal,comparator,(Comparable<?>)attr);
    }
 else {
      return typedVal.equals(attr);
    }
  }
 catch (  final Exception didNotWork) {
    return false;
  }
}

private static boolean compareReflective ( final String val , final int comparator , final Object attr ) { final Class < ? > clazz = attr . getClass ( ) ; Object typedVal = null ; try { final Constructor < ? > constr = clazz . getConstructor ( String . class ) ; typedVal = constr . newInstance ( new Object [ ] { val } ) ; if ( attr instanceof Comparable ) { return compareTyped ( typedVal , comparator , ( Comparable < ? > ) attr ) ; } else { return typedVal . equals ( attr ) ; } } catch ( final Exception didNotWork ) { return false ; } }
compare in a generic way by using reflection to create a corresponding object from the filter values string and compare this object with the attribute .
