code: public static boolean isNullValue(Entity entity, Attribute attribute) {
      boolean isNullValue;
      String attributeName = attribute.getName();
      AttributeType attributeType = attribute.getDataType();
      switch (attributeType) {
        case BOOL:
          isNullValue = entity.getBoolean(attributeName) == null;
          break;
        case CATEGORICAL:
        case FILE:
        case XREF:
          isNullValue = entity.getEntity(attributeName) == null;
          break;
        case CATEGORICAL_MREF:
        case MREF:
        case ONE_TO_MANY:
          Iterable<Entity> refEntities = entity.getEntities(attributeName);
          isNullValue = Iterables.isEmpty(refEntities);
          break;
        case COMPOUND:
          throw new RuntimeException(format("Invalid data type [%s]", attribute.getDataType()));
        case DATE:
          isNullValue = entity.getLocalDate(attributeName) == null;
          break;
        case DATE_TIME:
          isNullValue = entity.getInstant(attributeName) == null;
          break;
        case DECIMAL:
          isNullValue = entity.getDouble(attributeName) == null;
          break;
        case EMAIL:
        case ENUM:
        case HTML:
        case HYPERLINK:
        case SCRIPT:
        case STRING:
        case TEXT:
          isNullValue = entity.getString(attributeName) == null;
          break;
        case INT:
          isNullValue = entity.getInt(attributeName) == null;
          break;
        case LONG:
          isNullValue = entity.getLong(attributeName) == null;
          break;
        default:
          throw new UnexpectedEnumException(attributeType);
      }
      return isNullValue;
    }
docs: Returns whether an entity attribute value is <tt>null</tt> or empty for attributes referencing
  multiple entities.