public void add(Class definedIn, String fieldName, Class itemType) { add(definedIn, fieldName, null, itemType); }
public Class getItemTypeForItemFieldName(Class definedIn, String itemFieldName) { ImplicitCollectionMapperForClass mapper = getMapper(definedIn, null); if (mapper != null) { return mapper.getItemTypeForItemFieldName(itemFieldName); } else { return null; } }
ImplicitCollectionMapperForClass mapper = getOrCreateMapper(definedIn); mapper.add(new ImplicitCollectionMappingImpl(fieldName, itemType, itemFieldName, keyFieldName));
mapper = new AttributeAliasingMapper(mapper); mapper = new SystemAttributeAliasingMapper(mapper); mapper = new ImplicitCollectionMapper(mapper, reflectionProvider); mapper = new OuterClassMapper(mapper); mapper = new ArrayMapper(mapper);
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; }
public void add(Class definedIn, String fieldName, String itemFieldName, Class itemType) { add(definedIn, fieldName, itemFieldName, itemType, null); }
public String getFieldNameForItemTypeAndName(Class definedIn, Class itemType, String itemFieldName) { ImplicitCollectionMapperForClass mapper = getMapper(definedIn, null); if (mapper != null) { return mapper.getFieldNameForItemTypeAndName(itemType, itemFieldName); } else { return null; } }
mapper = new AttributeAliasingMapper(mapper); mapper = new SystemAttributeAliasingMapper(mapper); mapper = new ImplicitCollectionMapper(mapper); mapper = new OuterClassMapper(mapper); mapper = new ArrayMapper(mapper);
public void add(Class definedIn, String fieldName, String itemFieldName, Class itemType) { Field field = null; while (definedIn != Object.class) { try { field = definedIn.getDeclaredField(fieldName); break; } catch (SecurityException e) { throw new InitializationException( "Access denied for field with implicit collection", e); } catch (NoSuchFieldException e) { definedIn = definedIn.getSuperclass(); } } if (field == null) { throw new InitializationException("No field \"" + fieldName + "\" for implicit collection"); } else if (!Collection.class.isAssignableFrom(field.getType())) { throw new InitializationException("Field \"" + fieldName + "\" declares no collection"); } ImplicitCollectionMapperForClass mapper = getOrCreateMapper(definedIn); mapper.add(new ImplicitCollectionMappingImpl(fieldName, itemType, itemFieldName)); }
/** * Adds an implicit map. * * @param ownerType class owning the implicit map * @param fieldName name of the field in the ownerType. This field must be a concrete * map type or matching the default implementation type of the map * type. * @param itemName alias name of the items * @param itemType type of the items to be part of this map as value * @param keyFieldName the name of the field of the itemType that is used for the key in the map * @since 1.4 */ public void addImplicitMap(Class ownerType, String fieldName, String itemName, Class itemType, String keyFieldName) { if (implicitCollectionMapper == null) { throw new com.thoughtworks.xstream.InitializationException("No " + ImplicitCollectionMapper.class.getName() + " available"); } implicitCollectionMapper.add(ownerType, fieldName, itemName, itemType, keyFieldName); }
public ImplicitCollectionMapping getImplicitCollectionDefForFieldName(Class itemType, String fieldName) { ImplicitCollectionMapperForClass mapper = getMapper(itemType, fieldName); if (mapper != null) { return mapper.getImplicitCollectionDefForFieldName(fieldName); } else { return null; } }
mapper = new AttributeAliasingMapper(mapper); mapper = new SystemAttributeAliasingMapper(mapper); mapper = new ImplicitCollectionMapper(mapper); mapper = new OuterClassMapper(mapper); mapper = new ArrayMapper(mapper);
final ImplicitCollectionMapperForClass mapper = getOrCreateMapper(definedIn); mapper.add(new ImplicitCollectionMappingImpl(fieldName, itemType, itemFieldName, keyFieldName));
implicitCollectionMapper.add( field.getDeclaringClass(), fieldName, itemFieldName != null && !"".equals(itemFieldName) ? itemFieldName : null, } else { if (itemFieldName != null && !"".equals(itemFieldName)) { implicitCollectionMapper.add( field.getDeclaringClass(), fieldName, itemFieldName, itemType); } else { implicitCollectionMapper .add(field.getDeclaringClass(), fieldName, itemType);
@Override public String getFieldNameForItemTypeAndName(final Class<?> definedIn, final Class<?> itemType, final String itemFieldName) { final ImplicitCollectionMapperForClass mapper = getMapper(definedIn, null); if (mapper != null) { return mapper.getFieldNameForItemTypeAndName(itemType, itemFieldName); } else { return null; } }
mapper = new AttributeAliasingMapper(mapper); mapper = new SystemAttributeAliasingMapper(mapper); mapper = new ImplicitCollectionMapper(mapper); mapper = new OuterClassMapper(mapper); mapper = new ArrayMapper(mapper);
public void add(Class definedIn, String fieldName, String itemFieldName, Class itemType) { Field field = null; while (definedIn != Object.class) { try { field = definedIn.getDeclaredField(fieldName); break; } catch (SecurityException e) { throw new InitializationException( "Access denied for field with implicit collection", e); } catch (NoSuchFieldException e) { definedIn = definedIn.getSuperclass(); } } if (field == null) { throw new InitializationException("No field \"" + fieldName + "\" for implicit collection"); } else if (!Collection.class.isAssignableFrom(field.getType())) { throw new InitializationException("Field \"" + fieldName + "\" declares no collection"); } ImplicitCollectionMapperForClass mapper = getOrCreateMapper(definedIn); mapper.add(new ImplicitCollectionMappingImpl(fieldName, itemType, itemFieldName)); }
@Override public Class<?> getItemTypeForItemFieldName(final Class<?> definedIn, final String itemFieldName) { final ImplicitCollectionMapperForClass mapper = getMapper(definedIn, null); if (mapper != null) { return mapper.getItemTypeForItemFieldName(itemFieldName); } else { return null; } }
mapper = new AttributeAliasingMapper(mapper); mapper = new SystemAttributeAliasingMapper(mapper); mapper = new ImplicitCollectionMapper(mapper, reflectionProvider); mapper = new OuterClassMapper(mapper); mapper = new ArrayMapper(mapper);