Throw exception if type of Comaparable in Fields is other than Integer or String. Not sure about this one, but, after all, you are trying to cast to Integer below,
which will cause a ClassCastException if Comparable is like a float. Nit.