本文整理匯總了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);
}
}
}
}
示例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);
}
}