当前位置: 首页>>代码示例>>Java>>正文


Java XStream.processAnnotations方法代码示例

本文整理汇总了Java中com.thoughtworks.xstream.XStream.processAnnotations方法的典型用法代码示例。如果您正苦于以下问题:Java XStream.processAnnotations方法的具体用法?Java XStream.processAnnotations怎么用?Java XStream.processAnnotations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.thoughtworks.xstream.XStream的用法示例。


在下文中一共展示了XStream.processAnnotations方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validUnits2FromXml

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
@DataProvider
public Iterator<Object[]> validUnits2FromXml() throws IOException {
    String xml = "";

    try (BufferedReader reader = new BufferedReader(new FileReader(new File("src/test/resources/units2.xml")))) {
        String line = reader.readLine();
        while (line != null) {
            xml += line;
            line = reader.readLine();
        }
    }

    XStream xStream = new XStream();
    xStream.processAnnotations(Unit2Data.class);
    List<Unit2Data> units2 = (List<Unit2Data>)xStream.fromXML(xml);
    return units2.stream().map((g) -> new Object[] {g}).collect(Collectors.toList()).iterator();
}
 
开发者ID:SpaceHead1C,项目名称:module-template,代码行数:18,代码来源:Unit2CreationTests.java

示例2: getXML

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
/**
 * transforms user into XML string
 *
 * @param user
 * @return
 */
private String getXML (Type toWrite) {
    XStream xstream = new XStream(new DomDriver());
    xstream.ignoreUnknownElements();
    xstream.processAnnotations(SocialProfile.class);
    return xstream.toXML(toWrite);
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:13,代码来源:XStreamWriter.java

示例3: validGroupsFromXml

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
@DataProvider
public Iterator<Object[]> validGroupsFromXml() throws IOException {
    try (BufferedReader reader = new BufferedReader(new FileReader(new File ("src/test/resources/groups.xml")))) {
        String xml = "";
        String line = reader.readLine();
        while (line != null) {
            xml += line;
            line = reader.readLine();
        }
        XStream xstream = new XStream();
        xstream.processAnnotations(GroupData.class);
        List<GroupData> groups = (List<GroupData>)xstream.fromXML(xml);
        return groups.stream().map((g) -> new Object[] {g}).collect(Collectors.toList()).iterator();
    }
}
 
开发者ID:LadyTurandot,项目名称:Java_Good,代码行数:16,代码来源:GroupCreationTests.java

示例4: createXStream

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
static XStream createXStream() {
    XStream xStream = new XStream();
    xStream.processAnnotations(new Class[]{
            ConvenienceSetterConfig.class
    });
    xStream.alias("convenienceSetterConfig", ConvenienceSetterConfig.class);
    xStream.addImplicitCollection(ConvenienceSetterConfig.class, "convenienceSetterConfigs", "javaType", DataTypeConvenienceSetterConfig.class);
    xStream.addImplicitCollection(DataTypeConvenienceSetterConfig.class, "convenienceSetters", "convenienceSetter", ConvenienceSetterModel.class);
    xStream.addDefaultImplementation(ArrayList.class, List.class);
    xStream.aliasAttribute(DataTypeConvenienceSetterConfig.class, "javaDataTypeName", "name");
    xStream.useAttributeFor(ConvenienceSetterModel.class, "setterJavaTypeName");
    xStream.useAttributeFor(ConvenienceSetterModel.class, "fullyQualifiedConverterMethodName");
    return xStream;
}
 
开发者ID:btc-ag,项目名称:redg,代码行数:15,代码来源:XmlFileConvenienceSetterProvider.java

示例5: toBean

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
public static <T> T toBean(String xml, Class<T> cls) {
	XStream xstream = new XStream();

	xstream.processAnnotations(cls);
	T obj = (T) xstream.fromXML(xml);

	return obj;
}
 
开发者ID:xwjie,项目名称:ElementVueSpringbootCodeTemplate,代码行数:9,代码来源:XMLConfig.java

示例6: registerClass

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
/**
 * 会自动注册该类及其子类
 * @param clz 要注册的类
 */
public static void registerClass(Class<?> clz) {
  XStream xstream = XStreamInitializer.getInstance();
  xstream.processAnnotations(clz);
  xstream.processAnnotations(getInnerClasses(clz));
  register(clz, xstream);
}
 
开发者ID:11590692,项目名称:Wechat-Group,代码行数:11,代码来源:XStreamTransformer.java

示例7: toXml

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
public static String toXml(DnaTable object){
    XStream xStream = new XStream();
    xStream.autodetectAnnotations(true);
    xStream.processAnnotations(DnaTable.class);
    String top = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n";  
    return top + xStream.toXML(object);
}
 
开发者ID:bbedword,项目名称:AutoDnaCode,代码行数:8,代码来源:AutoCodeUtil.java

示例8: xmlStringToBean

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
/**
 * 把XML转成对象
 *
 * @param input
 *            InputStream
 * @return Object
 */
@SuppressWarnings("unchecked")
public static <T> T xmlStringToBean(InputStream input, Class<T> cls) {
	XStream xstream = new XStream(new DomDriver());
	xstream.processAnnotations(cls);
	xstream.autodetectAnnotations(true);
	return (T) xstream.fromXML(input);
}
 
开发者ID:yi-jun,项目名称:aaden-pay,代码行数:15,代码来源:XmlBeanJsonConverUtil.java

示例9: saveAsXml

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
private void saveAsXml(List<ContactData> contacts, File file) throws IOException {
    XStream xstream = new XStream();
    xstream.processAnnotations(ContactData.class);
    String xml = xstream.toXML(contacts);
    try (Writer writer = new FileWriter(file)) {
        writer.write(xml);
    }
}
 
开发者ID:LadyTurandot,项目名称:Java_Good,代码行数:9,代码来源:ContactDataGenerator.java

示例10: serialize

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
public String serialize(Object object) {
	XStream xstream = new XStream();
	xstream.processAnnotations(object.getClass());
	return xstream.toXML(object);
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:6,代码来源:XmlSerializer.java

示例11: serialize

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
public String serialize(Object object) {
	XStream xstream = new XStream(new JettisonMappedXmlDriver());
	xstream.processAnnotations(object.getClass());
	return xstream.toXML(object);
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:6,代码来源:JsonSerializer.java

示例12: xml2Flow

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
protected Flow xml2Flow(File xmlfile) throws FileNotFoundException{
    XStream xs = new XStream();
    xs.processAnnotations(new Class[]{Flow.class,Start.class,End.class,RuleSet.class,Rule.class,Split.class,Constraint.class,Parallel.class,Merge.class});
    return (Flow)xs.fromXML(new FileInputStream(xmlfile));
}
 
开发者ID:wangwei86609,项目名称:osmanthus,代码行数:6,代码来源:RuleTranslator.java

示例13: fromXml

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
public static <T> T fromXml(Class<T> clazz, InputStream is) {
  XStream xstream = XStreamInitializer.getInstance();
  xstream.alias("xml", clazz);
  xstream.processAnnotations(clazz);
  return (T) xstream.fromXML(is);
}
 
开发者ID:11590692,项目名称:Wechat-Group,代码行数:7,代码来源:ApiTestModule.java

示例14: xml2Rule

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
protected Rule xml2Rule(File file) throws FileNotFoundException{
    XStream xs = new XStream();
    xs.processAnnotations(new Class[]{Start.class,End.class,RuleSet.class,Rule.class,Split.class,Constraint.class,Parallel.class,Merge.class});
    return (Rule)xs.fromXML(new FileInputStream(file));
}
 
开发者ID:wangwei86609,项目名称:osmanthus,代码行数:6,代码来源:RuleTranslator.java

示例15: toXML

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
public String toXML() {
  XStream xstream = XStreamInitializer.getInstance();
  xstream.processAnnotations(this.getClass());
  return xstream.toXML(this);
}
 
开发者ID:11590692,项目名称:Wechat-Group,代码行数:6,代码来源:WxPayBaseRequest.java


注:本文中的com.thoughtworks.xstream.XStream.processAnnotations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。