This constraint enforces whether an object can be null as well as if the data type of
the object beign validated is the same or subclass of the data type given.
ConstraintException If the constraint is violated.
if (obj == null) {
if (!optional) {
throw new ConstraintException(ConstraintExceptionType.NULL_NOT_ALLOWED);
}
} else {
if (!dataType.isAssignableFrom(obj.getClass())) {
throw new ConstraintException(ConstraintExceptionType.INVALID_DATA_TYPE);
}
}