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


Java Mode类代码示例

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


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

示例1: write

import org.simpleframework.xml.stream.Mode; //导入依赖的package包/类
/**
 * This <code>write</code> method will write the specified object
 * to the given XML element as as list entries. Each entry within
 * the given list must be assignable to the given primitive type.
 * This will deserialize each entry type as a primitive value. In
 * order to do this the parent string provided forms the element.
 * 
 * @param node this is the parent output node to write values to
 * @param source this is the source collection to be serialized 
 * @param mode this is used to determine whether to output CDATA    
 */ 
private void write(OutputNode node, Object source, Mode mode) throws Exception {
   Collection list = (Collection) source;
   
   for(Object item : list) {
      if(item != null) {
         OutputNode child = node.getChild(parent);
      
         if(!isOverridden(child, item)) { 
            child.setMode(mode);
            root.write(child, item);
         }
      }
   }
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:26,代码来源:PrimitiveInlineList.java

示例2: write

import org.simpleframework.xml.stream.Mode; //导入依赖的package包/类
/**
 * This <code>write</code> method will write the key value pairs
 * within the provided map to the specified XML node. This will 
 * write each entry type must contain a key and value so that
 * the entry can be deserialized in to the map as a pair. If the
 * key or value object is composite it is read as a root object 
 * so its <code>Root</code> annotation must be present.
 * 
 * @param node this is the node the map is to be written to
 * @param map this is the source map that is to be written 
 * @param mode this is the mode that has been inherited
 */
private void write(OutputNode node, Map map, Mode mode) throws Exception {   
   String root = entry.getEntry();
   String name = style.getElement(root);
   
   for(Object index : map.keySet()) {
      OutputNode next = node.getChild(name);
      Object item = map.get(index);            
      
      next.setMode(mode); 
      key.write(next, index);            
      value.write(next, item);                  
   }
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:26,代码来源:CompositeInlineMap.java


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