Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.guvnor.structure.backend.config;
 
 import  com.thoughtworks.xstream.XStream;
 import  org.guvnor.structure.server.config.ConfigGroup;
 import  org.guvnor.structure.server.config.ConfigItem;
 import  org.guvnor.structure.server.config.ConfigType;
 import  org.guvnor.structure.server.config.SecureConfigItem;

Marshall a ConfigGroup to and from XML
public class ConfigGroupMarshaller {
    private final XStream backwardCompatibleXstream = new XStream();
    private final XStream xstream = new XStream();
    public ConfigGroupMarshaller() {
        .alias( "group",
                       ConfigGroup.class );
        .alias( "item",
                       ConfigItem.class );
        .alias( "type",
                       ConfigType.class );
        .alias("secureitem",
                       SecureConfigItem.class);
        // for backward compatibility only
        .alias("org.uberfire.backend.server.config.SecureConfigItem",
                       SecureConfigItem.class);
        .alias( "group",
                ConfigGroup.class );
        .alias( "item",
                ConfigItem.class );
        .alias( "type",
                ConfigType.class );
        .alias("secureitem",
                SecureConfigItem.class);
    }
    public String marshallfinal ConfigGroup configGroup ) {
        return .toXML( configGroup );
    }
    public ConfigGroup unmarshallfinal String xml ) {
        return (ConfigGroup) .fromXML( xml );
    }
New to GrepCode? Check out our FAQ X