@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()); } } }
/** * 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; }
/** * 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; }
@Override public boolean write(Type type, Object source, NodeMap<OutputNode> node, Map map) throws Exception { XmlWriteContext writeContext = createWriteContext(map); boolean complete = false; if (strategy != null) { complete = strategy.write(type, source, node, writeContext); } return complete || write(type, source, node.getNode(), writeContext); }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
@Override public Value read(Type type, NodeMap<InputNode> node, Map map) throws Exception { XmlReadContext readContext = createReadContext(map); Value value = null; if (strategy != null) { value = strategy.read(type, node, readContext); } return isReference(value) ? value : read(type, node.getNode(), value, readContext); }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }