public int defineEnum(EnumInfo newInfo) {
    Integer existingId = enumInfoToId.get(newInfo);
    if (existingId != null) {
      return existingId;
    }
    int id = distributedTypeRegistry.defineEnum(newInfo);
    EnumInfo oldInfo = idToEnum.get(id);
    if (oldInfo == null) {
      idToEnum.put(id, newInfo);
      enumInfoToId.put(newInfo, id);
      if (logger.isInfoEnabled()) {
        logger.info("Caching PDX Enum: {}, dsid={} typenum={}", newInfo, id >> 24, id & 0xFFFFFF);
      }
    } else if (!oldInfo.equals(newInfo)) {
      Assert.fail("Old enum does not equal new enum for the same id. oldEnum=" + oldInfo
          + " newEnum=" + newInfo);
    }
    return id;
  }
Given an enum compute and return a code for it.
geode-core/src/main/java/org/apache/geode/pdx/internal/TypeRegistry.java