public Element getState() { final Element element = new Element(COMPONENT_NAME); JDOMExternalizerUtil.writeField( element, INSTRUMENTATION_TYPE_NAME, myInstrumentationType.toString()); JDOMExternalizerUtil.writeField(element, LANGUAGE_ANNOTATION_NAME, myLanguageAnnotation); JDOMExternalizerUtil.writeField(element, PATTERN_ANNOTATION_NAME, myPatternAnnotation); JDOMExternalizerUtil.writeField(element, SUBST_ANNOTATION_NAME, mySubstAnnotation); JDOMExternalizerUtil.writeField( element, RESOLVE_REFERENCES, String.valueOf(myResolveReferences)); final List<String> injectorIds = new ArrayList<String>(myInjections.keySet()); Collections.sort(injectorIds); for (String key : injectorIds) { final List<BaseInjection> injections = new ArrayList<BaseInjection>(myInjections.get(key)); if (myDefaultInjections != null) { injections.removeAll(myDefaultInjections); } Collections.sort( injections, new Comparator<BaseInjection>() { public int compare(final BaseInjection o1, final BaseInjection o2) { return Comparing.compare(o1.getDisplayName(), o2.getDisplayName()); } }); for (BaseInjection injection : injections) { element.addContent(injection.getState()); } } return element; }
private void writeState(final Element element) { JDOMExternalizerUtil.writeField( element, INSTRUMENTATION_TYPE_NAME, myInstrumentationType.toString()); JDOMExternalizerUtil.writeField(element, LANGUAGE_ANNOTATION_NAME, myLanguageAnnotation); JDOMExternalizerUtil.writeField(element, PATTERN_ANNOTATION_NAME, myPatternAnnotation); JDOMExternalizerUtil.writeField(element, SUBST_ANNOTATION_NAME, mySubstAnnotation); if (myIncludeUncomputablesAsLiterals) { JDOMExternalizerUtil.writeField(element, INCLUDE_UNCOMPUTABLES_AS_LITERALS, "true"); } if (mySourceModificationAllowed) { JDOMExternalizerUtil.writeField(element, SOURCE_MODIFICATION_ALLOWED, "true"); } switch (myDfaOption) { case OFF: break; case RESOLVE: JDOMExternalizerUtil.writeField(element, RESOLVE_REFERENCES, Boolean.TRUE.toString()); break; case ASSIGNMENTS: JDOMExternalizerUtil.writeField( element, LOOK_FOR_VAR_ASSIGNMENTS, Boolean.TRUE.toString()); break; case DFA: JDOMExternalizerUtil.writeField(element, USE_DFA_IF_AVAILABLE, Boolean.TRUE.toString()); break; } }
public void setInstrumentationType(@Nullable String type) { if (type != null) { setInstrumentationType(InstrumentationType.valueOf(type)); } }