de.retest.ui.descriptors.RenderContainedElementsAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of retest-model Show documentation
Show all versions of retest-model Show documentation
The domain model for both retest and recheck.
package de.retest.ui.descriptors;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.adapters.XmlAdapter;
public class RenderContainedElementsAdapter extends XmlAdapter {
private final boolean renderLightweightXml;
public RenderContainedElementsAdapter() {
renderLightweightXml = false;
}
public RenderContainedElementsAdapter( final boolean renderLightweightXml ) {
this.renderLightweightXml = renderLightweightXml;
}
@Override
public Element marshal( final Element descriptor ) throws Exception {
if ( descriptor instanceof RootElement ) {
return descriptor;
}
return renderLightweightXml ? null : descriptor;
}
private final Map elements = new HashMap();
@Override
public Element unmarshal( final Element descriptor ) throws Exception {
if ( descriptor.identifyingAttributes == null ) {
return descriptor;
}
if ( elements.containsKey( descriptor ) ) {
return elements.get( descriptor );
}
elements.put( descriptor, descriptor );
return descriptor;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy