}
public static XStream createXStream() {
JVM jvm = new JVM();
ReflectionProvider reflectionProvider = jvm.bestReflectionProvider();
XStream xstream = new XStream(reflectionProvider);
// AbstractName
xstream.alias("abstractName", AbstractName.class);
xstream.addImmutableType(AbstractName.class);
xstream.registerConverter(new AbstractNameConverter());
// AbstractNameQuery
xstream.alias("abstractNameQuery", AbstractNameQuery.class);
xstream.addImmutableType(AbstractNameQuery.class);
xstream.registerConverter(new AbstractNameQueryConverter());
// Artifact
xstream.alias("artifact", Artifact.class);
xstream.addImmutableType(Artifact.class);
// ConfigurationData
xstream.alias("configurationData", ConfigurationData.class);
xstream.registerConverter(new ConfigurationDataConverter(reflectionProvider, xstream.getClassMapper()));
// ConfigurationModuleTypeConverter
xstream.alias("moduleType", ConfigurationModuleType.class);
xstream.addImmutableType(ConfigurationModuleType.class);
xstream.registerConverter(new ConfigurationModuleTypeConverter());
// Dependency
xstream.alias("dependency", Dependency.class);
xstream.addImmutableType(Dependency.class);
// GBeanData
xstream.alias("gbean", GBeanData.class);
xstream.registerConverter(new GBeanDataConverter(xstream.getClassMapper()));
// GBeanInfo
xstream.alias("gbean-info", GBeanInfo.class);
// w3c Dom
xstream.registerConverter(new DomConverter());
// ImportType
xstream.addImmutableType(ImportType.class);
xstream.registerConverter(new ImportTypeConverter());
// QName
try {
xstream.registerConverter(new QNameConverter());
} catch (Exception e) {
// cl can't see QName class so we don't need to register a converter for it
}
// Version
xstream.alias("version", Version.class);
xstream.addImmutableType(Version.class);
xstream.registerConverter(new VersionConverter());
// URI
xstream.alias("uri", URI.class);
xstream.addImmutableType(URI.class);
xstream.registerConverter(new URIConverter());
// XStreamGBeanState
xstream.registerConverter(new XStreamGBeanStateConverter());
return xstream;
}