protected void addDefaults() { // null handling addDefaultImplementation(null, Mapper.Null.class); // register primitive types addDefaultImplementation(Boolean.class, boolean.class); addDefaultImplementation(Character.class, char.class); addDefaultImplementation(Integer.class, int.class); addDefaultImplementation(Float.class, float.class); addDefaultImplementation(Double.class, double.class); addDefaultImplementation(Short.class, short.class); addDefaultImplementation(Byte.class, byte.class); addDefaultImplementation(Long.class, long.class); }
public DefaultImplementationsMapper(Mapper wrapped) { super(wrapped); addDefaults(); }
mapper = new OuterClassMapper(mapper); mapper = new ArrayMapper(mapper); mapper = new DefaultImplementationsMapper(mapper); mapper = new AttributeMapper(mapper, converterLookup, reflectionProvider); if (JVM.isVersion(5)) {
private Mapper buildMapper(ClassLoader cl) { // method exists to replace the default Mapper with the ClassLoaderMapper Mapper mapper = new ClassLoaderMapper(registry, cl); // note do not use XStream11XmlFriendlyMapper mapper = new ClassAliasingMapper(mapper); mapper = new FieldAliasingMapper(mapper); mapper = new AttributeAliasingMapper(mapper); mapper = new AttributeMapper(mapper); mapper = new ImplicitCollectionMapper(mapper); mapper = new DynamicProxyMapper(mapper); if (JVM.is15()) { mapper = new EnumMapper(mapper); } mapper = new OuterClassMapper(mapper); mapper = new ArrayMapper(mapper); mapper = new DefaultImplementationsMapper(mapper); mapper = new ImmutableTypesMapper(mapper); mapper = new CachingMapper(mapper); return mapper; }
/** * Associate a default implementation of a class with an object. Whenever XStream encounters * an instance of this type, it will use the default implementation instead. For example, * java.util.ArrayList is the default implementation of java.util.List. * * @param defaultImplementation * @param ofType * @throws InitializationException if no {@link DefaultImplementationsMapper} is available */ public void addDefaultImplementation(Class defaultImplementation, Class ofType) { if (defaultImplementationsMapper == null) { throw new com.thoughtworks.xstream.InitializationException("No " + DefaultImplementationsMapper.class.getName() + " available"); } defaultImplementationsMapper.addDefaultImplementation(defaultImplementation, ofType); }
public DefaultImplementationsMapper(Mapper wrapped) { super(wrapped); addDefaults(); }
mapper = new OuterClassMapper(mapper); mapper = new ArrayMapper(mapper); mapper = new DefaultImplementationsMapper(mapper); mapper = new AttributeMapper(mapper, converterLookup); if (JVM.is15()) {
private void processAliasAnnotation(final Class<?> type, final Set<Class<?>> types) { final XStreamAlias aliasAnnotation = type.getAnnotation(XStreamAlias.class); if (aliasAnnotation != null) { if (classAliasingMapper == null) { throw new InitializationException("No " + ClassAliasingMapper.class.getName() + " available"); } classAliasingMapper.addClassAlias(aliasAnnotation.value(), type); if (aliasAnnotation.impl() != Void.class) { // Alias for Interface/Class with an impl defaultImplementationsMapper.addDefaultImplementation( aliasAnnotation.impl(), type); if (type.isInterface()) { types.add(aliasAnnotation.impl()); // alias Interface's impl } } } }
public DefaultImplementationsMapper(final Mapper wrapped) { super(wrapped); addDefaults(); }
mapper = new OuterClassMapper(mapper); mapper = new ArrayMapper(mapper); mapper = new DefaultImplementationsMapper(mapper); mapper = new AttributeMapper(mapper, converterLookup, reflectionProvider); if (JVM.is15()) {
protected void addDefaults() { // null handling addDefaultImplementation(null, Mapper.Null.class); // register primitive types addDefaultImplementation(Boolean.class, boolean.class); addDefaultImplementation(Character.class, char.class); addDefaultImplementation(Integer.class, int.class); addDefaultImplementation(Float.class, float.class); addDefaultImplementation(Double.class, double.class); addDefaultImplementation(Short.class, short.class); addDefaultImplementation(Byte.class, byte.class); addDefaultImplementation(Long.class, long.class); }
public DefaultImplementationsMapper(Mapper wrapped) { super(wrapped); addDefaults(); }
mapper = new OuterClassMapper(mapper); mapper = new ArrayMapper(mapper); mapper = new DefaultImplementationsMapper(mapper); mapper = new AttributeMapper(mapper, converterLookup); if (JVM.is15()) {
protected void addDefaults() { // null handling addDefaultImplementation(null, Mapper.Null.class); // register primitive types addDefaultImplementation(Boolean.class, boolean.class); addDefaultImplementation(Character.class, char.class); addDefaultImplementation(Integer.class, int.class); addDefaultImplementation(Float.class, float.class); addDefaultImplementation(Double.class, double.class); addDefaultImplementation(Short.class, short.class); addDefaultImplementation(Byte.class, byte.class); addDefaultImplementation(Long.class, long.class); }
public DefaultImplementationsMapper(Mapper wrapped) { super(wrapped); addDefaults(); }
mapper = new OuterClassMapper(mapper); mapper = new ArrayMapper(mapper); mapper = new DefaultImplementationsMapper(mapper); mapper = new AttributeMapper(mapper, converterLookup, reflectionProvider); mapper = new EnumMapper(mapper);
protected void addDefaults() { // null handling addDefaultImplementation(null, Mapper.Null.class); // register primitive types addDefaultImplementation(Boolean.class, boolean.class); addDefaultImplementation(Character.class, char.class); addDefaultImplementation(Integer.class, int.class); addDefaultImplementation(Float.class, float.class); addDefaultImplementation(Double.class, double.class); addDefaultImplementation(Short.class, short.class); addDefaultImplementation(Byte.class, byte.class); addDefaultImplementation(Long.class, long.class); }
public DefaultImplementationsMapper(Mapper wrapped) { super(wrapped); addDefaults(); }
mapper = new OuterClassMapper(mapper); mapper = new ArrayMapper(mapper); mapper = new DefaultImplementationsMapper(mapper); mapper = new AttributeMapper(mapper, converterLookup, reflectionProvider); if (JVM.isVersion(5)) {
protected void addDefaults() { // null handling addDefaultImplementation(null, Mapper.Null.class); // register primitive types addDefaultImplementation(Boolean.class, boolean.class); addDefaultImplementation(Character.class, char.class); addDefaultImplementation(Integer.class, int.class); addDefaultImplementation(Float.class, float.class); addDefaultImplementation(Double.class, double.class); addDefaultImplementation(Short.class, short.class); addDefaultImplementation(Byte.class, byte.class); addDefaultImplementation(Long.class, long.class); }