本文整理汇总了Java中org.simpleframework.xml.stream.NodeMap.remove方法的典型用法代码示例。如果您正苦于以下问题:Java NodeMap.remove方法的具体用法?Java NodeMap.remove怎么用?Java NodeMap.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.simpleframework.xml.stream.NodeMap
的用法示例。
在下文中一共展示了NodeMap.remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readVersion
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
/**
* This method is used to read the version from the provided input
* node. Once the version has been read it is used to determine how
* to deserialize the object. If the version is not the initial
* version then it is read in a manner that ignores excessive XML
* elements and attributes. Also none of the annotated fields or
* methods are required if the version is not the initial version.
*
* @param node the XML element contact values are deserialized from
* @param source this object whose contacts are to be deserialized
* @param schema this object visits the objects contacts
*/
private void readVersion(InputNode node, Object source, Schema schema) throws Exception {
Label label = schema.getVersion();
Class expect = type.getType();
if(label != null) {
String name = label.getName();
NodeMap<InputNode> map = node.getAttributes();
InputNode value = map.remove(name);
if(value != null) {
readVersion(value, source, label);
} else {
Version version = context.getVersion(expect);
Double start = revision.getDefault();
Double expected = version.revision();
criteria.set(label, start);
revision.compare(expected, start);
}
}
}
示例2: write
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
public boolean write(Type field, Object value, NodeMap<OutputNode> node, Map map) throws Exception {
boolean done = strategy.write(field, value, node, map);
Node entry = node.remove("class");
if(entry != null) {
String className = entry.getValue();
Class type = Class.forName(className);
String name = forward.get(type);
if(name == null) {
throw new PersistenceException("Could not find alias for class %s", className);
}
node.put("type", name);
}
return done;
}
示例3: readValue
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
/**
* This is used to resolve and load a class for the given element.
* Resolution of the class to used is done by inspecting the
* XML element provided. If there is a "class" attribute on the
* element then its value is used to resolve the class to use.
* If no such attribute exists the specified field is returned,
* or if the field type is an array then the component type.
*
* @param type this is the type of the XML element expected
* @param node this is the element used to resolve an override
*
* @return returns the class that should be used for the object
*
* @throws Exception thrown if the class cannot be resolved
*/
private Class readValue(Type type, NodeMap node) throws Exception {
Node entry = node.remove(label);
Class expect = type.getType();
if(entry != null) {
String name = entry.getValue();
Class actual = loader.load(name);
// Arrays are annotated with the type of the element.
if (expect.isArray()) {
if (actual == expect.getComponentType())
actual = expect;
else
actual = Array.newInstance(actual, 0).getClass();
}
expect = actual;
}
return expect;
}
示例4: read
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
/**
* This is used to recover the object references from the document
* using the special attributes specified. This allows the element
* specified by the <code>NodeMap</code> to be used to discover
* exactly which node in the object graph the element represents.
*
* @param type the type of the field or method in the instance
* @param node this is the XML element to be deserialized
*
* @return this is used to return the type to acquire the value
*/
public Value read(Type type, NodeMap node) throws Exception {
Node entry = node.remove(label);
Class expect = type.getType();
if(entry != null) {
String name = entry.getValue();
Class actual = loader.load(name);
// Arrays are annotated with the type of the element.
if (expect.isArray()) {
if (actual == expect.getComponentType())
actual = expect;
else
actual = Array.newInstance(actual, 0).getClass();
}
expect = actual;
}
return readInstance(type, expect, node);
}
示例5: read
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
/**
* This is used to recover the object references from the document
* using the special attributes specified. This allows the element
* specified by the <code>NodeMap</code> to be used to discover
* exactly which node in the object graph the element represents.
*
* @param type the type of the field or method in the instance
* @param node this is the XML element to be deserialized
*
* @return this is used to return the type to acquire the value
*/
public Value read(Type type, NodeMap node) throws Exception {
Node entry = node.remove(label);
Class expect = type.getType();
if(expect.isArray()) {
expect = expect.getComponentType();
}
if(entry != null) {
String name = entry.getValue();
expect = loader.load(name);
}
return readInstance(type, expect, node);
}
示例6: readInstance
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
/**
* This is used to recover the object references from the document
* using the special attributes specified. This allows the element
* specified by the <code>NodeMap</code> to be used to discover
* exactly which node in the object graph the element represents.
*
* @param type the type of the field or method in the instance
* @param real this is the overridden type from the XML element
* @param node this is the XML element to be deserialized
*
* @return this is used to return the type to acquire the value
*/
private Value readInstance(Type type, Class real, NodeMap node) throws Exception {
Node entry = node.remove(mark);
if(entry == null) {
return readReference(type, real, node);
}
String key = entry.getValue();
if(containsKey(key)) {
throw new CycleException("Element '%s' already exists", key);
}
return readValue(type, real, node, key);
}
示例7: readReference
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
/**
* This is used to recover the object references from the document
* using the special attributes specified. This allows the element
* specified by the <code>NodeMap</code> to be used to discover
* exactly which node in the object graph the element represents.
*
* @param type the type of the field or method in the instance
* @param real this is the overridden type from the XML element
* @param node this is the XML element to be deserialized
*
* @return this is used to return the type to acquire the value
*/
private Value readReference(Type type, Class real, NodeMap node) throws Exception {
Node entry = node.remove(refer);
if(entry == null) {
return readValue(type, real, node);
}
String key = entry.getValue();
Object value = get(key);
if(!containsKey(key)) {
throw new CycleException("Invalid reference '%s' found", key);
}
return new Reference(value, real);
}
示例8: write
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
public void write(Type field, NodeMap<OutputNode> node) throws Exception {
OutputNode value = node.remove("class");
if(value != null) {
String type = value.getValue();
String name = new PackageParser().parse(type);
if(name == null) {
throw new PersistenceException("Could not match class %s", type);
}
if(comment) {
node.getNode().setComment(type);
}
node.getNode().getNamespaces().setReference(name, "class");
node.getNode().setReference(name);
}
}
示例9: read
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
public Value read(Type field, NodeMap<InputNode> node, Map map) throws Exception {
Node entry = node.remove("type");
if(entry != null) {
String value = entry.getValue();
Class type = backward.get(value);
if(type == null) {
throw new PersistenceException("Could not find class for alias %s", value);
}
node.put("class", type.getName());
}
return strategy.read(field, node, map);
}
示例10: read
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
public Value read(Type field, NodeMap node, Map map) throws Exception {
Node value = node.remove(ELEMENT_NAME);
if(value == null) {
return null;
}
String name = value.getValue();
Class type = Class.forName(name);
return new SimpleType(type);
}
示例11: read
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
public void read(Class field, NodeMap<InputNode> node) throws Exception{
InputNode value = node.remove(replace);
if(value != null) {
String name = value.getValue();
String type = read.get(name);
if(type == null) {
throw new PersistenceException("Could not match name %s", name);
}
node.put(label, type);
}
}
示例12: write
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
public void write(Class field, NodeMap<OutputNode> node) throws Exception {
OutputNode value = node.remove(label);
if(value != null) {
String type = value.getValue();
String name = write.get(type);
if(name == null) {
throw new PersistenceException("Could not match class %s", type);
}
node.put(replace, name);
}
}
示例13: readArray
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
/**
* This is used to resolve and load a class for the given element.
* Resolution of the class to used is done by inspecting the
* XML element provided. If there is a "class" attribute on the
* element then its value is used to resolve the class to use.
* This also expects a "length" attribute for the array length.
*
* @param type this is the type of the XML element expected
* @param node this is the element used to resolve an override
*
* @return returns the class that should be used for the object
*
* @throws Exception thrown if the class cannot be resolved
*/
private Value readArray(Class type, NodeMap node) throws Exception {
Node entry = node.remove(length);
int size = 0;
if(entry != null) {
String value = entry.getValue();
size = Integer.parseInt(value);
}
return new ArrayValue(type, size);
}
示例14: readValue
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
/**
* This is used to resolve and load a class for the given element.
* Resolution of the class to used is done by inspecting the
* XML element provided. If there is a "class" attribute on the
* element then its value is used to resolve the class to use.
* If no such attribute exists the specified field is returned,
* or if the field type is an array then the component type.
*
* @param type this is the type of the XML element expected
* @param node this is the element used to resolve an override
*
* @return returns the class that should be used for the object
*
* @throws Exception thrown if the class cannot be resolved
*/
private Class readValue(Type type, NodeMap node) throws Exception {
Node entry = node.remove(label);
Class expect = type.getType();
if(expect.isArray()) {
expect = expect.getComponentType();
}
if(entry != null) {
String name = entry.getValue();
expect = loader.load(name);
}
return expect;
}
示例15: readArray
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
/**
* This is used to acquire the <code>Value</code> which can be used
* to represent the deserialized value. The type create cab be
* added to the graph of created instances if the XML element has
* an identification attribute, this allows cycles to be completed.
*
* @param type the type of the field or method in the instance
* @param real this is the overridden type from the XML element
* @param node this is the XML element to be deserialized
*
* @return this is used to return the type to acquire the value
*/
private Value readArray(Type type, Class real, NodeMap node) throws Exception {
Node entry = node.remove(length);
int size = 0;
if(entry != null) {
String value = entry.getValue();
size = Integer.parseInt(value);
}
return new ArrayValue(real, size);
}