code: public static boolean onAutoGenerateId(Field idField, Object idValue)
      {
          if (idField.isAnnotationPresent(GeneratedValue.class))
          {
              return !isIdSet(idValue, idField);
          }
  
          return false;
      }
docs: Validates and set id, in case not set and intended for auto generation.
  
  @param idField
  id field
  @param idValue
  value of id attribute.
  @return returns true if id is not set and @GeneratedValue annotation is
  present. Else false.