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


Java OutputNode.commit方法代码示例

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


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

示例1: writeList

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
private static <T> void writeList(Serializer ser, OutputStream os, String listElement, List<T> list) throws Exception {
	Format format = new Format("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
	OutputNode doc = NodeBuilder.write(new OutputStreamWriter(os, UTF_8), format);
	OutputNode root = doc.getChild("root");
	root.setComment(BACKUP_COMMENT);
	OutputNode listNode = root.getChild(listElement);

	if (list != null) {
		for (T t : list) {
			try {
				ser.write(t, listNode);
			} catch (Exception e) {
				log.debug("Exception While writing node of type: " + t.getClass(), e);
			}
		}
	}
	root.commit();
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:19,代码来源:BackupExport.java

示例2: write

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
/**
 * This <code>write</code> method is used to convert the provided
 * object to an XML element. This creates a child node from the
 * given <code>OutputNode</code> object. Once this child element 
 * is created it is populated with the fields of the source object
 * in accordance with the XML schema class.  
 * 
 * @param source this is the object to be serialized to XML
 * @param expect this is the class that is expected to be written
 * @param name this is the name of the root annotation used 
 * 
 * @throws Exception thrown if there is a problem serializing
 */
public void write(OutputNode node, Object source, Class expect, String name) throws Exception {
   OutputNode child = node.getChild(name);
   Type type = getType(expect);
   
   if(source != null) {
      Class actual = source.getClass();
      Decorator decorator = getDecorator(actual);
      
      if(decorator != null) {
         decorator.decorate(child);
      }
      if(!context.setOverride(type, source, child)) {
         getComposite(actual).write(child, source);         
      }
   }         
   child.commit();      
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:31,代码来源:Traverser.java

示例3: testNotInlineString

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void testNotInlineString() throws Exception 
{
   Source source = new Source(new TreeStrategy(), new Support(), new Session());
   MockElementMap map = new MockElementMap(false, // attribute
                                           false, // data
                                           "entry", // entry 
                                           true,  // inline
                                           "key", // key
                                           String.class, // keyType
                                           "name", // name
                                           true, // required
                                           "value", // value
                                           String.class); // valueType
   PrimitiveType type = new PrimitiveType(map);
   Contact string = type.getString();
   Entry entry = new Entry(string, map);
   CompositeInlineMap value = new CompositeInlineMap(source, entry, new ClassType(Map.class));
   OutputNode node = NodeBuilder.write(new PrintWriter(System.out));
   Map exampleMap = new HashMap();
   
   exampleMap.put("a", "1");
   exampleMap.put("b", "2");
   value.write(node.getChild("notInlineString").getChild("map"), exampleMap);
   node.commit();            
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:26,代码来源:CompositeInlineMapTest.java

示例4: testNoAttributeString

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void testNoAttributeString() throws Exception 
{
   Source source = new Source(new TreeStrategy(), new Support(), new Session());
   MockElementMap map = new MockElementMap(false, // attribute
                                           false, // data
                                           "entry", // entry 
                                           true,  // inline
                                           "", // key
                                           String.class, // keyType
                                           "name", // name
                                           true, // required
                                           "value", // value
                                           String.class); // valueType
   PrimitiveType type = new PrimitiveType(map);
   Contact string = type.getString();
   Entry entry = new Entry(string, map);
   CompositeInlineMap value = new CompositeInlineMap(source, entry, new ClassType(Map.class));
   OutputNode node = NodeBuilder.write(new PrintWriter(System.out));
   Map exampleMap = new HashMap();
   
   exampleMap.put("a", "1");
   exampleMap.put("b", "2");      
   value.write(node.getChild("noAttributeString").getChild("map"), exampleMap);
   node.commit();
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:26,代码来源:CompositeInlineMapTest.java

示例5: testAttributeNoKeyString

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void testAttributeNoKeyString() throws Exception 
{
   Source source = new Source(new TreeStrategy(), new Support(), new Session());
   MockElementMap map = new MockElementMap(true, // attribute
                                           false, // data
                                           "entry", // entry 
                                           true,  // inline
                                           "", // key
                                           String.class, // keyType
                                           "name", // name
                                           true, // required
                                           "value", // value
                                           String.class); // valueType
   PrimitiveType type = new PrimitiveType(map);
   Contact string = type.getString();
   Entry entry = new Entry(string, map);
   CompositeInlineMap value = new CompositeInlineMap(source, entry, new ClassType(Map.class));
   OutputNode node = NodeBuilder.write(new PrintWriter(System.out));
   Map exampleMap = new HashMap();
   
   exampleMap.put("a", "1");
   exampleMap.put("b", "2");
   value.write(node.getChild("attributeNoKeyString").getChild("map"), exampleMap);
   node.commit();
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:26,代码来源:CompositeInlineMapTest.java

示例6: testInlineString

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void testInlineString() throws Exception 
{
   Source source = new Source(new TreeStrategy(), new Support(), new Session());
   MockElementMap map = new MockElementMap(true, // attribute
                                           false, // data
                                           "entry", // entry 
                                           true,  // inline
                                           "key", // key
                                           String.class, // keyType
                                           "name", // name
                                           true, // required
                                           "value", // value
                                           String.class); // valueType
   PrimitiveType type = new PrimitiveType(map);
   Contact string = type.getString();
   Entry entry = new Entry(string, map);
   PrimitiveValue value = new PrimitiveValue(source, entry, new ClassType(String.class));
   OutputNode node = NodeBuilder.write(new PrintWriter(System.out));
   
   value.write(node.getChild("inlineString"), "example");
   node.commit();
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:23,代码来源:PrimitiveValueTest.java

示例7: testNotInlineString

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void testNotInlineString() throws Exception 
{
   Source source = new Source(new TreeStrategy(), new Support(), new Session());
   MockElementMap map = new MockElementMap(false, // attribute
                                           false, // data
                                           "entry", // entry 
                                           true,  // inline
                                           "key", // key
                                           String.class, // keyType
                                           "name", // name
                                           true, // required
                                           "value", // value
                                           String.class); // valueType
   PrimitiveType type = new PrimitiveType(map);
   Contact string = type.getString();
   Entry entry = new Entry(string, map);
   PrimitiveValue value = new PrimitiveValue(source, entry, new ClassType(String.class));
   OutputNode node = NodeBuilder.write(new PrintWriter(System.out));
   
   value.write(node.getChild("notInlineString"), "example");
   node.commit();            
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:23,代码来源:PrimitiveValueTest.java

示例8: testNoAttributeString

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void testNoAttributeString() throws Exception 
{
   Source source = new Source(new TreeStrategy(), new Support(), new Session());
   MockElementMap map = new MockElementMap(false, // attribute
                                           false, // data
                                           "entry", // entry 
                                           true,  // inline
                                           "", // key
                                           String.class, // keyType
                                           "name", // name
                                           true, // required
                                           "value", // value
                                           String.class); // valueType
   PrimitiveType type = new PrimitiveType(map);
   Contact string = type.getString();
   Entry entry = new Entry(string, map);
   PrimitiveValue value = new PrimitiveValue(source, entry, new ClassType(String.class));
   OutputNode node = NodeBuilder.write(new PrintWriter(System.out));
   
   value.write(node.getChild("noAttributeString"), "example");
   node.commit();
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:23,代码来源:PrimitiveValueTest.java

示例9: testAttributeNoKeyString

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void testAttributeNoKeyString() throws Exception 
{
   Source source = new Source(new TreeStrategy(), new Support(), new Session());
   MockElementMap map = new MockElementMap(true, // attribute
                                           false, // data
                                           "entry", // entry 
                                           true,  // inline
                                           "", // key
                                           String.class, // keyType
                                           "name", // name
                                           true, // required
                                           "value", // value
                                           String.class); // valueType
   PrimitiveType type = new PrimitiveType(map);
   Contact string = type.getString();
   Entry entry = new Entry(string, map);
   PrimitiveValue value = new PrimitiveValue(source, entry, new ClassType(String.class));
   OutputNode node = NodeBuilder.write(new PrintWriter(System.out));
   
   value.write(node.getChild("attributeNoKeyString"), "example");
   node.commit();
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:23,代码来源:PrimitiveValueTest.java

示例10: testInlineString

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void testInlineString() throws Exception 
{
   Source source = new Source(new TreeStrategy(), new Support(), new Session());
   MockElementMap map = new MockElementMap(true, // attribute
                                           false, // data
                                           "entry", // entry 
                                           true,  // inline
                                           "key", // key
                                           String.class, // keyType
                                           "name", // name
                                           true, // required
                                           "value", // value
                                           String.class); // valueType
   PrimitiveType type = new PrimitiveType(map);
   Contact string = type.getString();
   Entry entry = new Entry(string, map);
   CompositeMap value = new CompositeMap(source, entry, new ClassType(Map.class));
   OutputNode node = NodeBuilder.write(new PrintWriter(System.out));
   Map exampleMap = new HashMap();
   
   exampleMap.put("a", "1");
   exampleMap.put("b", "2");      
   value.write(node.getChild("inlineString"), exampleMap);
   node.commit();
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:26,代码来源:CompositeMapTest.java

示例11: testNotInlineString

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void testNotInlineString() throws Exception 
{
   Source source = new Source(new TreeStrategy(), new Support(), new Session());
   MockElementMap map = new MockElementMap(false, // attribute
                                           false, // data
                                           "entry", // entry 
                                           true,  // inline
                                           "key", // key
                                           String.class, // keyType
                                           "name", // name
                                           true, // required
                                           "value", // value
                                           String.class); // valueType
   PrimitiveType type = new PrimitiveType(map);
   Contact string = type.getString();
   Entry entry = new Entry(string, map);
   CompositeMap value = new CompositeMap(source, entry, new ClassType(Map.class));
   OutputNode node = NodeBuilder.write(new PrintWriter(System.out));
   Map exampleMap = new HashMap();
   
   exampleMap.put("a", "1");
   exampleMap.put("b", "2");
   value.write(node.getChild("notInlineString"), exampleMap);
   node.commit();            
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:26,代码来源:CompositeMapTest.java

示例12: testNoAttributeString

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void testNoAttributeString() throws Exception 
{
   Source source = new Source(new TreeStrategy(), new Support(), new Session());
   MockElementMap map = new MockElementMap(false, // attribute
                                           false, // data
                                           "entry", // entry 
                                           true,  // inline
                                           "", // key
                                           String.class, // keyType
                                           "name", // name
                                           true, // required
                                           "value", // value
                                           String.class); // valueType
   PrimitiveType type = new PrimitiveType(map);
   Contact string = type.getString();
   Entry entry = new Entry(string, map);
   CompositeMap value = new CompositeMap(source, entry, new ClassType(Map.class));
   OutputNode node = NodeBuilder.write(new PrintWriter(System.out));
   Map exampleMap = new HashMap();
   
   exampleMap.put("a", "1");
   exampleMap.put("b", "2");      
   value.write(node.getChild("noAttributeString"), exampleMap);
   node.commit();
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:26,代码来源:CompositeMapTest.java

示例13: testAttributeNoKeyString

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void testAttributeNoKeyString() throws Exception 
{
   Source source = new Source(new TreeStrategy(), new Support(), new Session());
   MockElementMap map = new MockElementMap(true, // attribute
                                           false, // data
                                           "entry", // entry 
                                           true,  // inline
                                           "", // key
                                           String.class, // keyType
                                           "name", // name
                                           true, // required
                                           "value", // value
                                           String.class); // valueType
   PrimitiveType type = new PrimitiveType(map);
   Contact string = type.getString();
   Entry entry = new Entry(string, map);
   CompositeMap value = new CompositeMap(source, entry, new ClassType(Map.class));
   OutputNode node = NodeBuilder.write(new PrintWriter(System.out));
   Map exampleMap = new HashMap();
   
   exampleMap.put("a", "1");
   exampleMap.put("b", "2");
   value.write(node.getChild("attributeNoKeyString"), exampleMap);
   node.commit();
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:26,代码来源:CompositeMapTest.java

示例14: testInlineString

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void testInlineString() throws Exception 
{
   Source source = new Source(new TreeStrategy(), new Support(), new Session());
   MockElementMap map = new MockElementMap(true, // attribute
                                           false, // data
                                           "entry", // entry 
                                           true,  // inline
                                           "key", // key
                                           String.class, // keyType
                                           "name", // name
                                           true, // required
                                           "value", // value
                                           String.class); // valueType
   PrimitiveType type = new PrimitiveType(map);
   Contact string = type.getString();
   Entry entry = new Entry(string, map);
   PrimitiveKey value = new PrimitiveKey(source, entry, new ClassType(String.class));
   OutputNode node = NodeBuilder.write(new PrintWriter(System.out));
   
   value.write(node.getChild("inlineString"), "example");
   node.commit();
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:23,代码来源:PrimitiveKeyTest.java

示例15: testNotInlineString

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void testNotInlineString() throws Exception 
{
   Source source = new Source(new TreeStrategy(), new Support(), new Session());
   MockElementMap map = new MockElementMap(false, // attribute
                                           false, // data
                                           "entry", // entry 
                                           true,  // inline
                                           "key", // key
                                           String.class, // keyType
                                           "name", // name
                                           true, // required
                                           "value", // value
                                           String.class); // valueType
   PrimitiveType type = new PrimitiveType(map);
   Contact string = type.getString();
   Entry entry = new Entry(string, map);
   PrimitiveKey value = new PrimitiveKey(source, entry, new ClassType(String.class));
   OutputNode node = NodeBuilder.write(new PrintWriter(System.out));
   
   value.write(node.getChild("notInlineString"), "example");
   node.commit();            
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:23,代码来源:PrimitiveKeyTest.java


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