/** * 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); }
/** * 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); }
/** * 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); } }
/** * 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); }
/** * 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); } }
/** * 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); } }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
String name = label.getName(); NodeMap<InputNode> map = node.getAttributes(); InputNode value = map.remove(name);
String name = label.getName(); NodeMap<InputNode> map = node.getAttributes(); InputNode value = map.remove(name);