private boolean typesMatch(Class<V> valueType,Class getterType){
  if (getterType != valueType) {
    if (getterType.isPrimitive()) {
      return (getterType == float.class && valueType == Float.class) || (getterType == int.class && valueType == Integer.class) || (getterType == boolean.class && valueType == Boolean.class)|| (getterType == long.class && valueType == Long.class)|| (getterType == double.class && valueType == Double.class)|| (getterType == short.class && valueType == Short.class)|| (getterType == byte.class && valueType == Byte.class)|| (getterType == char.class && valueType == Character.class);
    }
    return false;
  }
  return true;
}

private boolean typesMatch ( Class < V > valueType , Class getterType ) { if ( getterType != valueType ) { if ( getterType . isPrimitive ( ) ) { return ( getterType == float . class && valueType == Float . class ) || ( getterType == int . class && valueType == Integer . class ) || ( getterType == boolean . class && valueType == Boolean . class ) || ( getterType == long . class && valueType == Long . class ) || ( getterType == double . class && valueType == Double . class ) || ( getterType == short . class && valueType == Short . class ) || ( getterType == byte . class && valueType == Byte . class ) || ( getterType == char . class && valueType == Character . class ) ; } return false ; } return true ; }
utility method to check whether the type of the underlying field / method on the target object matches the type of the property . the extra checks for primitive types are because generics will force the property type to be a class , whereas the type of the underlying method / field will probably be a primitive type instead . accept float as matching float , etc .
