com.thoughtworks.xstream.converters.basic.BooleanConverter Java Examples
The following examples show how to use
com.thoughtworks.xstream.converters.basic.BooleanConverter.
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 |
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: XStreamExtensionProvider.java From saros with GNU General Public License v2.0 | 5 votes |
/** * Create a new XStreamExtensionProvider using the given element name as the XML root element with * the given namespace. The Provider is able to understand the given classes, which should be * annotated using XStream annotations. * * <p><b>Important</b>: use valid XML element names and namespaces or the receiving side will be * unable to decode the extension ! */ public XStreamExtensionProvider(String namespace, String elementName, Class<?>... classes) { if (namespace == null) throw new NullPointerException("namespace is null"); ClassLoader classLoader = currentClassloader; this.elementName = elementName; this.namespace = namespace; xstream = XStreamFactory.getSecureXStream(); if (classLoader != null) xstream.setClassLoader(classLoader); else xstream.setClassLoader(getClass().getClassLoader()); xstream.registerConverter(BooleanConverter.BINARY); xstream.registerConverter(new UrlEncodingStringConverter()); xstream.processAnnotations(XStreamPacketExtension.class); xstream.processAnnotations(classes); xstream.alias(elementName, XStreamPacketExtension.class); ProviderManager providerManager = ProviderManager.getInstance(); providerManager.addExtensionProvider(getElementName(), getNamespace(), this); providerManager.addIQProvider(getElementName(), getNamespace(), this); // TODO Validate that elementName is a valid XML identifier replaceables = new HashMap<Class<? extends Converter>, ReplaceableConverter>(); replaceableSingles = new HashMap<Class<? extends SingleValueConverter>, ReplaceableSingleValueConverter>(); }