public static <T> void setId(final Object identifiableObject, final T id) {

    if (isSetIdMethodAvailable(identifiableObject, id)) {
      final MethodInvoker method = new MethodInvoker();

      method.setTargetObject(identifiableObject);
      method.setTargetMethod("setId");
      method.setArguments(id);

      try {
        method.prepare();
        method.invoke();
      } catch (Exception e) {
        throw new IllegalArgumentException(
            String.format("Failed to set ID (%1$s) on Object (%2$s)!", id, identifiableObject), e);
      }
    } else {
      LOGGER.warning(String.format(
          "Not able to set ID (%1$s) of type (%2$s) on Object of type (%3$s)", id,
          ObjectUtils.nullSafeClassName(id), ObjectUtils.nullSafeClassName(identifiableObject)));
    }
  }
The IdentifierUtils class is a utility class for working with Objects having identifiers
<p>

@since GemFire 8.0
geode-web-api/src/main/java/org/apache/geode/rest/internal/web/util/IdentifiableUtils.java