コード例 #1
0
  @SuppressWarnings({"HardCodedStringLiteral"})
  public static void writeExternal(
      final Element element,
      final Map<String, SmartRefElementPointer> persistentEntryPoints,
      final JDOMExternalizableStringList additional_annotations) {
    Element entryPointsElement = new Element("entry_points");
    entryPointsElement.setAttribute(VERSION_ATTR, VERSION);
    for (SmartRefElementPointer entryPoint : persistentEntryPoints.values()) {
      assert entryPoint.isPersistent();
      entryPoint.writeExternal(entryPointsElement);
    }

    element.addContent(entryPointsElement);
    if (!additional_annotations.isEmpty()) {
      try {
        additional_annotations.writeExternal(element);
      } catch (WriteExternalException ignored) {
      }
    }
  }
コード例 #2
0
 @SuppressWarnings({"HardCodedStringLiteral"})
 public void loadState(Element element) {
   Element entryPointsElement = element.getChild("entry_points");
   if (entryPointsElement != null) {
     final String version = entryPointsElement.getAttributeValue(VERSION_ATTR);
     if (!Comparing.strEqual(version, VERSION)) {
       convert(entryPointsElement, myPersistentEntryPoints);
     } else {
       List content = entryPointsElement.getChildren();
       for (final Object aContent : content) {
         Element entryElement = (Element) aContent;
         if (ENTRY_POINT_ATTR.equals(entryElement.getName())) {
           SmartRefElementPointerImpl entryPoint = new SmartRefElementPointerImpl(entryElement);
           myPersistentEntryPoints.put(entryPoint.getFQName(), entryPoint);
         }
       }
     }
   }
   try {
     ADDITIONAL_ANNOTATIONS.readExternal(element);
   } catch (InvalidDataException ignored) {
   }
 }