com.thoughtworks.xstream.XStream.addImplicitCollection()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(276)

本文整理了Java中com.thoughtworks.xstream.XStream.addImplicitCollection()方法的一些代码示例,展示了XStream.addImplicitCollection()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XStream.addImplicitCollection()方法的具体详情如下:
包路径:com.thoughtworks.xstream.XStream
类名称:XStream
方法名:addImplicitCollection

XStream.addImplicitCollection介绍

[英]Adds a default implicit collection which is used for any unmapped XML tag.
[中]添加用于任何未映射XML标记的默认隐式集合。

代码示例

代码示例来源:origin: com.thoughtworks.xstream/xstream

/**
 * Adds a default implicit collection which is used for any unmapped XML tag.
 *
 * @param ownerType class owning the implicit collection
 * @param fieldName name of the field in the ownerType. This field must be a concrete
 *            collection type or matching the default implementation type of the collection
 *            type.
 */
public void addImplicitCollection(Class ownerType, String fieldName) {
  addImplicitCollection(ownerType, fieldName, null, null);
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

/**
 * Adds an implicit array.
 *
 * @param ownerType class owning the implicit array
 * @param fieldName name of the array field
 * @since 1.4 
 */
public void addImplicitArray(Class ownerType, String fieldName) {
  addImplicitCollection(ownerType, fieldName);
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

/**
 * Adds an implicit array which is used for all items of the given element name defined by
 * itemName.
 * 
 * @param ownerType class owning the implicit array
 * @param fieldName name of the array field in the ownerType
 * @param itemName alias name of the items
 * @throws InitializationException if no {@link ImplicitCollectionMapper} is available
 * @since 1.4 
 */
public void addImplicitArray(Class ownerType, String fieldName, String itemName) {
  addImplicitCollection(ownerType, fieldName, itemName, null);
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

/**
 * Adds implicit collection which is used for all items of the given itemType.
 *
 * @param ownerType class owning the implicit collection
 * @param fieldName name of the field in the ownerType. This field must be a concrete
 *            collection type or matching the default implementation type of the collection
 *            type.
 * @param itemType type of the items to be part of this collection
 * @throws InitializationException if no {@link ImplicitCollectionMapper} is available
 */
public void addImplicitCollection(Class ownerType, String fieldName, Class itemType) {
  addImplicitCollection(ownerType, fieldName, null, itemType);
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

/**
 * Adds an implicit array which is used for all items of the given itemType when the array
 * type matches.
 * 
 * @param ownerType class owning the implicit array
 * @param fieldName name of the array field in the ownerType
 * @param itemType type of the items to be part of this array
 * @throws InitializationException if no {@link ImplicitCollectionMapper} is available or the
 * array type does not match the itemType
 * @since 1.4 
 */
public void addImplicitArray(Class ownerType, String fieldName, Class itemType) {
  addImplicitCollection(ownerType, fieldName, itemType);
}

代码示例来源:origin: spring-projects/spring-framework

String[] collectionFields = StringUtils.commaDelimitedListToStringArray(fields);
for (String collectionField : collectionFields) {
  xstream.addImplicitCollection(key, collectionField);

代码示例来源:origin: stackoverflow.com

XStream xstream = new XStream();
 xstream.alias("person", Person.class);
 xstream.alias("persons", PersonList.class);
 xstream.addImplicitCollection(PersonList.class, "list");
 PersonList list = new PersonList();
 list.add(new Person("ABC",12,"address"));
 list.add(new Person("XYZ",20,"address2"));
 String xml = xstream.toXML(list);

代码示例来源:origin: stackoverflow.com

XStream xstream = new XStream();
xstream.alias("comments", Comments.class);
xstream.alias("comment", Comment.class);
xstream.addImplicitCollection(Comments.class, "comments");
Comments comments = (Comments)xstream.fromXML(xml);

代码示例来源:origin: x-stream/xstream

/**
 * Adds an implicit array.
 *
 * @param ownerType class owning the implicit array
 * @param fieldName name of the array field
 * @since 1.4
 */
public void addImplicitArray(final Class<?> ownerType, final String fieldName) {
  addImplicitCollection(ownerType, fieldName);
}

代码示例来源:origin: x-stream/xstream

/**
 * Adds a default implicit collection which is used for any unmapped XML tag.
 *
 * @param ownerType class owning the implicit collection
 * @param fieldName name of the field in the ownerType. This field must be a concrete collection type or matching
 *            the default implementation type of the collection type.
 */
public void addImplicitCollection(final Class<?> ownerType, final String fieldName) {
  addImplicitCollection(ownerType, fieldName, null, null);
}

代码示例来源:origin: x-stream/xstream

/**
 * Adds implicit collection which is used for all items of the given itemType.
 *
 * @param ownerType class owning the implicit collection
 * @param fieldName name of the field in the ownerType. This field must be a concrete collection type or matching
 *            the default implementation type of the collection type.
 * @param itemType type of the items to be part of this collection
 * @throws InitializationException if no {@link ImplicitCollectionMapper} is available
 */
public void addImplicitCollection(final Class<?> ownerType, final String fieldName, final Class<?> itemType) {
  addImplicitCollection(ownerType, fieldName, null, itemType);
}

代码示例来源:origin: x-stream/xstream

/**
 * Adds an implicit array which is used for all items of the given element name defined by itemName.
 *
 * @param ownerType class owning the implicit array
 * @param fieldName name of the array field in the ownerType
 * @param itemName alias name of the items
 * @throws InitializationException if no {@link ImplicitCollectionMapper} is available
 * @since 1.4
 */
public void addImplicitArray(final Class<?> ownerType, final String fieldName, final String itemName) {
  addImplicitCollection(ownerType, fieldName, itemName, null);
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Adds a default implicit collection which is used for any unmapped XML tag.
 *
 * @param ownerType class owning the implicit collection
 * @param fieldName name of the field in the ownerType. This field must be a concrete
 *            collection type or matching the default implementation type of the collection
 *            type.
 */
public void addImplicitCollection(Class ownerType, String fieldName) {
  addImplicitCollection(ownerType, fieldName, null, null);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream

/**
 * Adds a default implicit collection which is used for any unmapped XML tag.
 *
 * @param ownerType class owning the implicit collection
 * @param fieldName name of the field in the ownerType. This field must be a concrete
 *            collection type or matching the default implementation type of the collection
 *            type.
 */
public void addImplicitCollection(Class ownerType, String fieldName) {
  addImplicitCollection(ownerType, fieldName, null, null);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream

/**
 * Adds an implicit array.
 *
 * @param ownerType class owning the implicit array
 * @param fieldName name of the array field
 * @since 1.4 
 */
public void addImplicitArray(Class ownerType, String fieldName) {
  addImplicitCollection(ownerType, fieldName);
}

代码示例来源:origin: eu.cedarsoft.utils/configuration

/**
 * Creates a new persister
 */
public XStreamPersister() {
 this.xStream = new XStream();
 xStream.alias( "configurations", Configurations.class );
 xStream.addImplicitCollection( Configurations.class, "configurations" );
}

代码示例来源:origin: HuaweiBigData/StreamCQL

/**
 * 设置Xstream别名
 *
 */
public static void setAlias(XStream xstream)
{
  for (Map.Entry< String, Class< ? > > et : ALIAS_MAPPING.entrySet())
  {
    xstream.alias(et.getKey(), et.getValue());
  }
  xstream.addImplicitCollection(Schema.class, "cols", "attribute", Column.class);
}

代码示例来源:origin: org.springframework.ws/spring-oxm

/**
 * Adds an implicit Collection for the given type.
 *
 * @see XStream#addImplicitCollection(Class, String)
 */
public void addImplicitCollection(String name, Class type) {
  getXStream().addImplicitCollection(type, name);
}

代码示例来源:origin: stackoverflow.com

XStream xstream = new XStream();
xstream.alias("employee", Employee.class);
xstream.alias("employees", EmployeeList.class);
xstream.addImplicitCollection(EmployeeList.class, "list");

EmployeeList list = new EmployeeList();
list.add(new Employee(1,"Vimal Jaiswal",50000));
list.add(new Employee(2,"Kamal",40000));

String xml = xstream.toXML(list);

代码示例来源:origin: anandbagmar/WAAT

private static XStream configureXStream() {
    XStream xStream = new XStream(new DomDriver());
    xStream.alias("Sections", TestData.class);
    xStream.omitField(TestData.class, "loadedSections");
    xStream.addImplicitCollection(TestData.class, "sectionsLoadedFromFile", "Section", Section.class);
    xStream = Section.configurePageLayoutXStream(xStream);
    return xStream;
  }
}

相关文章