コード例 #1
0
  private static void initializeAndModify(
      TypesCache temporaryTypes, ObjectType type, List<Class<?>> modifications) {
    State typeState = type.getState();
    Map<String, Object> typeOriginals = typeState.getSimpleValues();

    try {
      type.initialize();
      temporaryTypes.add(type);

      // Apply type-specific modifications.
      if (modifications != null) {
        for (Class<?> modification : modifications) {
          type.modify(modification);
        }
      }

    } catch (IncompatibleClassChangeError ex) {
      LOGGER.info(
          "Skipped initializing [{}] because its class is in an inconsistent state! ([{}])",
          type.getInternalName(),
          ex.getMessage());
    }

    if (typeState.isNew()) {
      type.save();

    } else if (!typeState.getSimpleValues().equals(typeOriginals)) {
      temporaryTypes.changed.add(type.getId());
    }
  }