final boolean intToLong = getPrimitiveObjectType().isAssignableFrom(Long.class)
&& value.getClass().isAssignableFrom(Integer.class);
if (!intToLong && !getPrimitiveObjectType().isInstance(value)) {
final ValidationException ve = new ValidationException();
ve.addMessage(this, "Property " + this + " only allows instances of "
+ getPrimitiveObjectType().getName() + " but the value is an instanceof "
+ value.getClass().getName());
throw ve;
}