/** * This provides the position of this node within the document. * This allows the user of this node to report problems with * the location within the document, allowing the XML to be * debugged if it does not match the class schema. * * @return this returns the position of the XML read cursor */ public Position getPosition() { return parent.getPosition(); }
/** * This provides the position of this node within the document. * This allows the user of this node to report problems with * the location within the document, allowing the XML to be * debugged if it does not match the class schema. * * @return this returns the position of the XML read cursor */ public Position getPosition() { return parent.getPosition(); }
/** * This provides the position of this node within the document. * This allows the user of this node to report problems with * the location within the document, allowing the XML to be * debugged if it does not match the class schema. * * @return this returns the position of the XML read cursor */ public Position getPosition() { return parent.getPosition(); }
/** * This <code>read</code> method will perform a read using the * provided object with the repeater. Reading with this method * ensures that any additional XML elements within the source * will be added to the value. * * @param node this is the node that contains the extra data * * @return this will return the original deserialized object */ public Object read(InputNode node, Object value) throws Exception { Position line = node.getPosition(); String name = node.getName(); if(reader instanceof Repeater) { Repeater repeat = (Repeater) reader; return repeat.read(node, value); } throw new PersistenceException("Element '%s' is already used with %s at %s", name, label, line); }
/** * This <code>read</code> method will perform a read using the * provided object with the repeater. Reading with this method * ensures that any additional XML elements within the source * will be added to the value. * * @param node this is the node that contains the extra data * * @return this will return the original deserialized object */ public boolean validate(InputNode node) throws Exception { Position line = node.getPosition(); String name = node.getName(); if(reader instanceof Repeater) { Repeater repeat = (Repeater) reader; return repeat.validate(node); } throw new PersistenceException("Element '%s' declared twice at %s", name, line); }
/** * This <code>read</code> method will perform a read using the * provided object with the repeater. Reading with this method * ensures that any additional XML elements within the source * will be added to the value. * * @param node this is the node that contains the extra data * * @return this will return the original deserialized object */ public Object read(InputNode node, Object value) throws Exception { Position line = node.getPosition(); String name = node.getName(); if(reader instanceof Repeater) { Repeater repeat = (Repeater) reader; return repeat.read(node, value); } throw new PersistenceException("Element '%s' is already used with %s at %s", name, label, line); }
/** * This <code>read</code> method will perform a read using the * provided object with the repeater. Reading with this method * ensures that any additional XML elements within the source * will be added to the value. * * @param node this is the node that contains the extra data * * @return this will return the original deserialized object */ public Object read(InputNode node, Object value) throws Exception { Position line = node.getPosition(); String name = node.getName(); if(reader instanceof Repeater) { Repeater repeat = (Repeater) reader; return repeat.read(node, value); } throw new PersistenceException("Element '%s' is already used with %s at %s", name, label, line); }
/** * This method is used to read the key value from the node. The * value read from the node is resolved using the template filter. * If the key value can not be found according to the annotation * attributes then null is assumed and returned. * * @param node this is the node to read the key value from * @param value this is the value to deserialize in to * * @return this returns the value deserialized from the node * * @throws Exception if value is not null an exception is thrown */ public Object read(InputNode node, Object value) throws Exception { Position line = node.getPosition(); Class expect = type.getType(); if(value != null) { throw new PersistenceException("Can not read key of %s for %s at %s", expect, entry, line); } return read(node); }
/** * This <code>read</code> method will perform a read using the * provided object with the repeater. Reading with this method * ensures that any additional XML elements within the source * will be added to the value. * * @param node this is the node that contains the extra data * * @return this will return the original deserialized object */ public boolean validate(InputNode node) throws Exception { Position line = node.getPosition(); String name = node.getName(); if(reader instanceof Repeater) { Repeater repeat = (Repeater) reader; return repeat.validate(node); } throw new PersistenceException("Element '%s' declared twice at %s", name, line); }
/** * This <code>read</code> method will perform a read using the * provided object with the repeater. Reading with this method * ensures that any additional XML elements within the source * will be added to the value. * * @param node this is the node that contains the extra data * * @return this will return the original deserialized object */ public boolean validate(InputNode node) throws Exception { Position line = node.getPosition(); String name = node.getName(); if(reader instanceof Repeater) { Repeater repeat = (Repeater) reader; return repeat.validate(node); } throw new PersistenceException("Element '%s' declared twice at %s", name, line); }
/** * Creates the array type to use. This will use the provided * XML element to determine the array type and provide a means * for creating an array with the <code>Value</code> object. If * the array size cannot be determined an exception is thrown. * * @param node this is the input node for the array element * * @return the object array type used for the instantiation */ public Instance getInstance(InputNode node) throws Exception { Position line = node.getPosition(); Value value = getOverride(node); if(value == null) { throw new ElementException("Array length required for %s at %s", type, line); } Class type = value.getType(); return getInstance(value, type); }
/** * Creates the array type to use. This will use the provided * XML element to determine the array type and provide a means * for creating an array with the <code>Value</code> object. If * the array size cannot be determined an exception is thrown. * * @param node this is the input node for the array element * * @return the object array type used for the instantiation */ public Instance getInstance(InputNode node) throws Exception { Position line = node.getPosition(); Value value = getOverride(node); if(value == null) { throw new ElementException("Array length required for %s at %s", type, line); } Class type = value.getType(); return getInstance(value, type); }
/** * This method checks to see if there are any <code>Label</code> * objects remaining in the provided map that are required. This is * used when validation is performed to ensure the the XML element * validated contains sufficient details to satisfy the XML schema * class annotations. If there is a required label that remains it * is reported within the exception thrown. * * @param node this is the node that contains the composite data * @param map this contains the converters to perform validation */ private void validate(InputNode node, LabelMap map) throws Exception { Position line = node.getPosition(); for(Label label : map) { Class expect = type.getType(); if(label.isRequired() && revision.isEqual()) { throw new ValueRequiredException("Unable to satisfy %s for %s at %s", label, expect, line); } } }
/** * This method checks to see if there are any <code>Label</code> * objects remaining in the provided map that are required. This is * used when validation is performed to ensure the the XML element * validated contains sufficient details to satisfy the XML schema * class annotations. If there is a required label that remains it * is reported within the exception thrown. * * @param node this is the node that contains the composite data * @param map this contains the converters to perform validation */ private void validate(InputNode node, LabelMap map) throws Exception { Position line = node.getPosition(); for(Label label : map) { Class expect = type.getType(); if(label.isRequired() && revision.isEqual()) { throw new ValueRequiredException("Unable to satisfy %s for %s at %s", label, expect, line); } } }
/** * Creates the array type to use. This will use the provided * XML element to determine the array type and provide a means * for creating an array with the <code>Value</code> object. If * the array size cannot be determined an exception is thrown. * * @param node this is the input node for the array element * * @return the object array type used for the instantiation */ public Instance getInstance(InputNode node) throws Exception { Position line = node.getPosition(); Value value = getOverride(node); if(value == null) { throw new ElementException("Array length required for %s at %s", type, line); } Class type = value.getType(); return getInstance(value, type); }
/** * This <code>validate</code> method is used to perform validation * of the provided node object using a delegate converter. This is * typically another <code>Composite</code> converter, or if the * node is an attribute a <code>Primitive</code> converter. If this * fails validation then an exception is thrown to report the issue. * * @param node this is the node that contains the contact value * @param label this is the label used to create the converter */ private void validate(InputNode node, Label label) throws Exception { Converter reader = label.getConverter(context); Position line = node.getPosition(); Class expect = type.getType(); boolean valid = reader.validate(node); if(valid == false) { throw new PersistenceException("Invalid value for %s in %s at %s", label, expect, line); } criteria.set(label, null); }
/** * This <code>validate</code> method is used to perform validation * of the provided node object using a delegate converter. This is * typically another <code>Composite</code> converter, or if the * node is an attribute a <code>Primitive</code> converter. If this * fails validation then an exception is thrown to report the issue. * * @param node this is the node that contains the contact value * @param label this is the label used to create the converter */ private void validate(InputNode node, Label label) throws Exception { Converter reader = label.getConverter(context); Position line = node.getPosition(); Class expect = type.getType(); boolean valid = reader.validate(node); if(valid == false) { throw new PersistenceException("Invalid value for %s in %s at %s", label, expect, line); } criteria.set(label, null); }
/** * This <code>validate</code> method is used to perform validation * of the provided node object using a delegate converter. This is * typically another <code>Composite</code> converter, or if the * node is an attribute a <code>Primitive</code> converter. If this * fails validation then an exception is thrown to report the issue. * * @param node this is the node that contains the contact value * @param label this is the label used to create the converter */ private void validate(InputNode node, Label label) throws Exception { Converter reader = label.getConverter(context); Position line = node.getPosition(); Class expect = type.getType(); boolean valid = reader.validate(node); if(valid == false) { throw new PersistenceException("Invalid value for %s in %s at %s", label, expect, line); } criteria.set(label, null); }
/** * This method is used to read the key value from the node. The * value read from the node is resolved using the template filter. * If the key value can not be found according to the annotation * attributes then null is assumed and the node is valid. * * @param node this is the node to read the key value from * * @return this returns the value deserialized from the node */ public boolean validate(InputNode node) throws Exception { Position line = node.getPosition(); Class expect = type.getType(); String name = entry.getKey(); if(name == null) { name = context.getName(expect); } if(entry.isAttribute()) { throw new ElementException("Can not have %s as an attribute for %s at %s", expect, entry, line); } return validate(node, name); }
/** * This method is used to read the key value from the node. The * value read from the node is resolved using the template filter. * If the key value can not be found according to the annotation * attributes then null is assumed and returned. * * @param node this is the node to read the key value from * * @return this returns the value deserialized from the node */ public Object read(InputNode node) throws Exception { Position line = node.getPosition(); Class expect = type.getType(); String name = entry.getKey(); if(name == null) { name = context.getName(expect); } if(entry.isAttribute()) { throw new AttributeException("Can not have %s as an attribute for %s at %s", expect, entry, line); } return read(node, name); }