com.thoughtworks.xstream.converters.reflection.ReflectionConverter Java Examples

The following examples show how to use com.thoughtworks.xstream.converters.reflection.ReflectionConverter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KieModuleMarshaller.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
private KieModuleMarshaller() {
    xStream = new XStream(new DomDriver()) {
        @Override
        protected void setupConverters() {
            registerConverter(new NullConverter(), PRIORITY_VERY_HIGH);
            registerConverter(new IntConverter(), PRIORITY_NORMAL);
            registerConverter(new FloatConverter(), PRIORITY_NORMAL);
            registerConverter(new DoubleConverter(), PRIORITY_NORMAL);
            registerConverter(new LongConverter(), PRIORITY_NORMAL);
            registerConverter(new ShortConverter(), PRIORITY_NORMAL);
            registerConverter(new BooleanConverter(), PRIORITY_NORMAL);
            registerConverter(new ByteConverter(), PRIORITY_NORMAL);
            registerConverter(new StringConverter(), PRIORITY_NORMAL);
            registerConverter(new CollectionConverter(getMapper()), PRIORITY_NORMAL);
            registerConverter(new ReflectionConverter(getMapper(), getReflectionProvider()), PRIORITY_VERY_LOW);
            registerConverter(new KieModuleConverter());
            registerConverter(new KieBaseModelImpl.KBaseConverter());
            registerConverter(new KieSessionModelImpl.KSessionConverter());
            registerConverter(new ListenerModelImpl.ListenerConverter());
            registerConverter(new QualifierModelImpl.QualifierConverter());
            registerConverter(new WorkItemHandlerModelImpl.WorkItemHandelerConverter());
            registerConverter(new ChannelModelImpl.ChannelConverter());
            registerConverter(new RuleTemplateModelImpl.RuleTemplateConverter());
        }
    };
    XStream.setupDefaultSecurity(xStream);
    xStream.addPermission(new AnyTypePermission());
    xStream.alias("kmodule", KieModuleModelImpl.class);
    xStream.alias("kbase", KieBaseModelImpl.class);
    xStream.alias("ksession", KieSessionModelImpl.class);
    xStream.alias("listener", ListenerModelImpl.class);
    xStream.alias("qualifier", QualifierModelImpl.class);
    xStream.alias("workItemHandler", WorkItemHandlerModelImpl.class);
    xStream.alias("channel", ChannelModelImpl.class);
    xStream.alias("fileLogger", FileLoggerModelImpl.class);
    xStream.alias("ruleTemplate", RuleTemplateModelImpl.class);
    xStream.setClassLoader(KieModuleModelImpl.class.getClassLoader());
}
 
Example #2
Source File: ExportToolContentService.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public FileConverter(XStream xstream) {
    this.defaultConverter = new ReflectionConverter(xstream.getMapper(), xstream.getReflectionProvider());
}
 
Example #3
Source File: XStreamValid.java    From Digital with GNU General Public License v3.0 4 votes vote down vote up
@Override
    protected void setupConverters() {
        this.registerConverter(new ReflectionConverter(getMapper(), getReflectionProvider()), -20);
        this.registerConverter(new SerializableConverter(getMapper(), getReflectionProvider(), getClassLoaderReference()), -10);
        this.registerConverter(new ExternalizableConverter(getMapper(), getClassLoaderReference()), -10);
        this.registerConverter(new NullConverter(), 10000);
        this.registerConverter(new IntConverter(), 0);
        this.registerConverter(new FloatConverter(), 0);
        this.registerConverter(new DoubleConverter(), 0);
        this.registerConverter(new LongConverter(), 0);
        this.registerConverter(new ShortConverter(), 0);
        this.registerConverter((Converter) (new CharConverter()), 0);
        this.registerConverter(new BooleanConverter(), 0);
        this.registerConverter(new ByteConverter(), 0);
        this.registerConverter(new StringConverter(), 0);
        this.registerConverter(new StringBufferConverter(), 0);
        this.registerConverter(new DateConverter(), 0);
        this.registerConverter(new BitSetConverter(), 0);
        this.registerConverter(new URIConverter(), 0);
        this.registerConverter(new URLConverter(), 0);
        this.registerConverter(new BigIntegerConverter(), 0);
        this.registerConverter(new BigDecimalConverter(), 0);
        this.registerConverter(new ArrayConverter(getMapper()), 0);
        this.registerConverter(new CharArrayConverter(), 0);
        this.registerConverter(new CollectionConverter(getMapper()), 0);
        this.registerConverter(new MapConverter(getMapper()), 0);
//        this.registerConverter((Converter)(new TreeMapConverter(getMapper())), 0);
//        this.registerConverter((Converter)(new TreeSetConverter(getMapper())), 0);
        this.registerConverter(new SingletonCollectionConverter(getMapper()), 0);
        this.registerConverter(new SingletonMapConverter(getMapper()), 0);
//        this.registerConverter((Converter)(new PropertiesConverter()), 0);
        this.registerConverter((Converter) (new EncodedByteArrayConverter()), 0);
        this.registerConverter(new FileConverter(), 0);
        if (JVM.isSQLAvailable()) {
            this.registerConverter(new SqlTimestampConverter(), 0);
            this.registerConverter(new SqlTimeConverter(), 0);
            this.registerConverter(new SqlDateConverter(), 0);
        }

//        this.registerConverter((Converter)(new DynamicProxyConverter(getMapper(), getClassLoaderReference())), 0);
        this.registerConverter(new JavaClassConverter(getClassLoaderReference()), 0);
        this.registerConverter(new JavaMethodConverter(getClassLoaderReference()), 0);
        this.registerConverter(new JavaFieldConverter(getClassLoaderReference()), 0);
        if (JVM.isAWTAvailable()) {
//            this.registerConverter((Converter)(new FontConverter(getMapper())), 0);
            this.registerConverter(new ColorConverter(), 0);
//            this.registerConverter((SingleValueConverter)(new TextAttributeConverter()), 0);
        }

        if (JVM.isSwingAvailable()) {
            this.registerConverter(new LookAndFeelConverter(getMapper(), getReflectionProvider()), 0);
        }

        this.registerConverter(new LocaleConverter(), 0);
        this.registerConverter(new GregorianCalendarConverter(), 0);

        this.registerConverter(new EnumConverter(), 0);

        this.registerConverter(new SelfStreamingInstanceChecker(getConverterLookup(), this), 0);
    }