當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。