org.simpleframework.xml.convert.Registry Java Examples
The following examples show how to use
org.simpleframework.xml.convert.Registry.
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: SimpleXmlParser.java From openkeepass with Apache License 2.0 | 6 votes |
private Serializer createSerializer(ProtectionStrategy protectionStrategy) { RegistryMatcher matcher = new RegistryMatcher(); matcher.bind(Boolean.class, BooleanSimpleXmlAdapter.class); matcher.bind(GregorianCalendar.class, CalendarSimpleXmlAdapter.class); matcher.bind(UUID.class, UUIDSimpleXmlAdapter.class); matcher.bind(byte[].class, ByteSimpleXmlAdapter.class); Registry registry = new Registry(); PropertyValueXmlAdapter converter = new PropertyValueXmlAdapter(protectionStrategy); try { registry.bind(PropertyValue.class, converter); Strategy strategy = new RegistryStrategy(registry); return new Persister(strategy, matcher); } catch (Exception e) { throw new KeePassDatabaseUnreadableException("Could not register xml converter", e); } }
Example #2
Source File: SardineUtil.java From sardine-android with Apache License 2.0 | 5 votes |
private static Serializer getSerializer() throws Exception { Format format = new Format("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); Registry registry = new Registry(); Strategy strategy = new RegistryStrategy(registry); Serializer serializer = new Persister(strategy, format); registry.bind(Prop.class, new EntityWithAnyElementConverter<>(serializer, Prop.class)); registry.bind(Resourcetype.class, new EntityWithAnyElementConverter<>(serializer, Resourcetype.class)); registry.bind(Property.class, Property.PropertyConverter.class); return serializer; }
Example #3
Source File: SimpleDatabase.java From KeePassJava2 with Apache License 2.0 | 5 votes |
/** * Utility to get a simple framework persister * @return a persister * @throws Exception when things get tough */ private static Serializer getSerializer() throws Exception { Registry registry = new Registry(); registry.bind(String.class, EmptyStringConverter.class); Strategy strategy = new AnnotationStrategy(new RegistryStrategy(registry)); return new Persister(strategy); }
Example #4
Source File: SardineUtil.java From simpletask-android with GNU General Public License v3.0 | 5 votes |
private static Serializer getSerializer() throws Exception { Format format = new Format("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); Registry registry = new Registry(); Strategy strategy = new RegistryStrategy(registry); Serializer serializer = new Persister(strategy, format); registry.bind(Prop.class, new EntityWithAnyElementConverter<>(serializer, Prop.class)); registry.bind(Resourcetype.class, new EntityWithAnyElementConverter<>(serializer, Resourcetype.class)); registry.bind(Property.class, Property.PropertyConverter.class); return serializer; }