code: private static void addRetrieveInternalModelId(CtClass clazz) throws NotFoundException,
          CannotCompileException {
          CtField modelIdField = null;
          CtClass temp = clazz;
          while (temp != null) {
              for (CtField field : temp.getDeclaredFields()) {
                  if (JavassistUtils.hasAnnotation(field, OpenEngSBModelId.class.getName())) {
                      modelIdField = field;
                      break;
                  }
              }
              temp = temp.getSuperclass();
          }
          CtClass[] params = generateClassField();
          CtMethod valueMethod = new CtMethod(cp.get(Object.class.getName()), "retrieveInternalModelId", params, clazz);
          StringBuilder builder = new StringBuilder();
          builder.append(createTrace("Called retrieveInternalModelId"));
          CtMethod idFieldGetter = getFieldGetter(modelIdField, clazz);
          if (modelIdField == null || idFieldGetter == null) {
              builder.append("return null;");
          } else {
              builder.append(String.format("return %s();", idFieldGetter.getName()));
          }
          valueMethod.setBody(createMethodBody(builder.toString()));
          clazz.addMethod(valueMethod);
  
          CtMethod nameMethod =
              new CtMethod(cp.get(String.class.getName()), "retrieveInternalModelIdName", generateClassField(), clazz);
          if (modelIdField == null) {
              nameMethod.setBody(createMethodBody("return null;"));
          } else {
              nameMethod.setBody(createMethodBody("return \"" + modelIdField.getName() + "\";"));
          }
          clazz.addMethod(nameMethod);
      }
docs: Adds the retrieveInternalModelId method to the class.