code: public static boolean serializeField(String keyName, Field field, Method getter) {
          log.trace("serializeField - keyName: {} field: {} method: {}", new Object[] { keyName, field, getter });
          // if "field" is a class or is transient, skip it
          if ("class".equals(keyName)) {
              return false;
          }
          if (field != null) {
              if (Modifier.isTransient(field.getModifiers())) {
                  log.trace("Skipping {} because its transient", keyName);
                  return false;
              } else if (field.isAnnotationPresent(DontSerialize.class)) {
                  log.trace("Skipping {} because its marked with @DontSerialize", keyName);
                  return false;
              }
          }
          if (getter != null && getter.isAnnotationPresent(DontSerialize.class)) {
              log.trace("Skipping {} because its marked with @DontSerialize", keyName);
              return false;
          }
          log.trace("Serialize field: {}", field);
          return true;
      }
docs: Checks whether the field should be serialized or not
  
  @param keyName
  key name
  @param field
  The field to be serialized
  @param getter
  Getter method for field
  @return <tt>true</tt> if the field should be serialized, otherwise <tt>false</tt>