本文整理汇总了Java中org.simpleframework.xml.stream.NodeMap.getNode方法的典型用法代码示例。如果您正苦于以下问题:Java NodeMap.getNode方法的具体用法?Java NodeMap.getNode怎么用?Java NodeMap.getNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.simpleframework.xml.stream.NodeMap
的用法示例。
在下文中一共展示了NodeMap.getNode方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: read
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
/**
* This is used to read the <code>Value</code> which will be used
* to represent the deserialized object. If there is an binding
* present then the value will contain an object instance. If it
* does not then it is up to the internal strategy to determine
* what the returned value contains.
*
* @param type this is the type that represents a method or field
* @param node this is the node representing the XML element
* @param value this is the value from the internal strategy
*
* @return the value representing the deserialized value
*/
private Value read(Type type, NodeMap<InputNode> node, Value value) throws Exception {
Converter converter = lookup(type, value);
InputNode source = node.getNode();
if(converter != null) {
Object data = converter.read(source);
Class actual = type.getType();
if(value != null) {
value.setValue(data);
}
return new Reference(value, data, actual);
}
return value;
}
示例2: read
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
/**
* This is used to read the <code>Value</code> which will be used
* to represent the deserialized object. If there is an annotation
* present then the value will contain an object instance. If it
* does not then it is up to the internal strategy to determine
* what the returned value contains.
*
* @param type this is the type that represents a method or field
* @param node this is the node representing the XML element
* @param value this is the value from the internal strategy
*
* @return the value representing the deserialized value
*/
private Value read(Type type, NodeMap<InputNode> node, Value value) throws Exception {
Converter converter = scanner.getConverter(type, value);
InputNode parent = node.getNode();
if(converter != null) {
Object data = converter.read(parent);
Class actual = type.getType();
if(value != null) {
value.setValue(data);
}
return new Reference(value, data, actual);
}
return value;
}
示例3: read
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
public Value read(Type type, NodeMap<InputNode> node, Map map) throws Exception {
Value value = strategy.read(type, node, map);
Convert convert = type.getAnnotation(Convert.class);
InputNode parent = node.getNode();
if(convert != null) {
Class<? extends Converter> converterClass = convert.value();
Constructor<? extends Converter> converterConstructor = converterClass.getDeclaredConstructor();
if(!converterConstructor.isAccessible()) {
converterConstructor.setAccessible(true);
}
Converter converter = converterConstructor.newInstance();
Object result = converter.read(parent);
return new Wrapper(result);
}
return value;
}
示例4: write
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
public boolean write(Type type, Object value, NodeMap<OutputNode> node, Map map) throws Exception {
Convert convert = type.getAnnotation(Convert.class);
OutputNode parent = node.getNode();
if(convert != null) {
Class<? extends Converter> converterClass = convert.value();
Constructor<? extends Converter> converterConstructor = converterClass.getDeclaredConstructor();
if(!converterConstructor.isAccessible()) {
converterConstructor.setAccessible(true);
}
Converter converter = converterConstructor.newInstance();
converter.write(parent, value);
return true;
}
return strategy.write(type, value, node, map);
}
示例5: write
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
@Override
public void write(final Type type, final NodeMap<OutputNode> node) throws Exception {
if (type.getType().equals(Command[].class)) {
OutputNode element = node.getNode();
StringBuilder builder = new StringBuilder("A configuration must have 9 commands, one for each button.\n Possible icons are:");
for (Command.Icon icon : Command.Icon.values())
builder.append("\n - ").append(icon.toString());
element.setComment(builder.toString());
}
}
示例6: write
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
@Override
public void write(Type type, NodeMap<OutputNode> node) throws Exception {
OutputNode outputNode = node.getNode();
if ("DdsRequestObject".equals(outputNode.getName())) {
OutputNode operationNameAtribute = outputNode.getParent().getAttributes().get("DdsOperationName");
outputNode.setName(operationNameAtribute.getValue());
}
}
示例7: read
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
public void read(Type type, NodeMap<InputNode> node){
InputNode element = node.getNode();
if(element.isRoot()) {
Object source = element.getSource();
Class sourceType = source.getClass();
Class itemType = type.getType();
System.out.printf(">>>>> ELEMENT=[%s]%n>>>>> TYPE=[%s]%n>>>>> SOURCE=[%s]%n", element, itemType, sourceType);
}
}
示例8: read
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
public Value read(Type field, NodeMap<InputNode> node, Map map) throws Exception {
Value value = strategy.read(field, node, map);
Class type = value == null ? field.getType() : value.getType();
Converter converter = registry.resolve(type);
if(converter != null) {
InputNode source = node.getNode();
Object data = converter.read(source);
return new Wrapper(value, data);
}
return value;
}
示例9: write
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
public boolean write(Type field, Object value, NodeMap<OutputNode> node, Map map) throws Exception {
boolean reference = strategy.write(field, value, node, map);
if(!reference) {
Class type = value.getClass();
Converter converter = registry.resolve(type);
OutputNode source = node.getNode();
if(converter != null) {
converter.write(source, value);
return true;
}
return false;
}
return reference;
}
示例10: write
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
public void write(Type type, NodeMap<OutputNode> node) throws Exception {
OutputNode parent = node.getNode();
String name = parent.getName();
name = name.toUpperCase();
parent.setName(name);
}
示例11: write
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
/**
* This is used to serialize a representation of the object value
* provided. If there is a <code>Registry</code> binding present
* for the provided type then this will use the converter specified
* to serialize a representation of the object. If however there
* is no binding present then this will delegate to the internal
* strategy. This returns true if the serialization has completed.
*
* @param type this is the type that represents the field or method
* @param value this is the object instance to be serialized
* @param node this is the XML element to be serialized to
*
* @return this returns true if it was serialized, false otherwise
*/
private boolean write(Type type, Object value, NodeMap<OutputNode> node) throws Exception {
Converter converter = lookup(type, value);
OutputNode source = node.getNode();
if(converter != null) {
converter.write(source, value);
return true;
}
return false;
}
示例12: write
import org.simpleframework.xml.stream.NodeMap; //导入方法依赖的package包/类
/**
* This is used to serialize a representation of the object value
* provided. If there is a <code>Convert</code> annotation present
* on the provided type then this will use the converter specified
* to serialize a representation of the object. If however there
* is no annotation then this will delegate to the internal
* strategy. This returns true if the serialization has completed.
*
* @param type this is the type that represents the field or method
* @param value this is the object instance to be serialized
* @param node this is the XML element to be serialized to
*
* @return this returns true if it was serialized, false otherwise
*/
private boolean write(Type type, Object value, NodeMap<OutputNode> node) throws Exception {
Converter converter = scanner.getConverter(type, value);
OutputNode parent = node.getNode();
if(converter != null) {
converter.write(parent, value);
return true;
}
return false;
}