/** * Constructor for the <code>VersionLabel</code> object. This is * used to create a label that can convert from a double to an * XML attribute and vice versa. This requires the annotation and * contact extracted from the XML schema class. * * @param contact this is the field from the XML schema class * @param label represents the annotation for the field * @param format this is the format used to style the paths */ public VersionLabel(Contact contact, Version label, Format format) { this.detail = new Introspector(contact, this, format); this.decorator = new Qualifier(contact); this.required = label.required(); this.type = contact.getType(); this.name = label.name(); this.format = format; this.label = label; }
/** * 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 the type of the object that is being deserialized * @param label this is the label used to read the version attribute */ private void readVersion(InputNode node, Object source, Label label) throws Exception { Object value = readInstance(node, source, label); Class expect = type.getType(); if(value != null) { Version version = context.getVersion(expect); Double actual = version.revision(); if(!value.equals(revision)) { revision.compare(actual, value); } } }
public class Package implements Identifiable { @Version(revision=1.1) private double version;
/** * Constructor for the <code>VersionLabel</code> object. This is * used to create a label that can convert from a double to an * XML attribute and vice versa. This requires the annotation and * contact extracted from the XML schema class. * * @param contact this is the field from the XML schema class * @param label represents the annotation for the field * @param format this is the format used to style the paths */ public VersionLabel(Contact contact, Version label, Format format) { this.detail = new Introspector(contact, this, format); this.decorator = new Qualifier(contact); this.required = label.required(); this.type = contact.getType(); this.name = label.name(); this.format = format; this.label = label; }
/** * 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 the type of the object that is being deserialized * @param label this is the label used to read the version attribute */ private void readVersion(InputNode node, Object source, Label label) throws Exception { Object value = readInstance(node, source, label); Class expect = type.getType(); if(value != null) { Version version = context.getVersion(expect); Double actual = version.revision(); if(!value.equals(revision)) { revision.compare(actual, value); } } }
@Version(revision=1.1) private double version;
/** * Constructor for the <code>VersionLabel</code> object. This is * used to create a label that can convert from a double to an * XML attribute and vice versa. This requires the annotation and * contact extracted from the XML schema class. * * @param contact this is the field from the XML schema class * @param label represents the annotation for the field * @param format this is the format used to style the paths */ public VersionLabel(Contact contact, Version label, Format format) { this.detail = new Introspector(contact, this, format); this.decorator = new Qualifier(contact); this.required = label.required(); this.type = contact.getType(); this.name = label.name(); this.format = format; this.label = label; }
/** * 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 the type of the object that is being deserialized * @param label this is the label used to read the version attribute */ private void readVersion(InputNode node, Object source, Label label) throws Exception { Object value = readInstance(node, source, label); Class expect = type.getType(); if(value != null) { Version version = context.getVersion(expect); Double actual = version.revision(); if(!value.equals(revision)) { revision.compare(actual, value); } } }
@Version(revision = 1.2) private double version;
/** * This method is used to write the version attribute. A version is * written only if it is not the initial version or if it required. * The version is used to determine how to deserialize the XML. If * the version is different from the expected version then it allows * the object to be deserialized in a manner that does not require * any attributes or elements, and unmatched nodes are ignored. * * @param node this is the node to read the version attribute from * @param source this is the source object that is to be written * @param schema this is the schema that contains the version */ private void writeVersion(OutputNode node, Object source, Schema schema) throws Exception { Version version = schema.getRevision(); Label label = schema.getVersion(); if(version != null) { Double start = revision.getDefault(); Double value = version.revision(); if(revision.compare(value, start)) { if(label.isRequired()) { writeAttribute(node, value, label); } } else { writeAttribute(node, value, label); } } }
/** * This method is used to write the version attribute. A version is * written only if it is not the initial version or if it required. * The version is used to determine how to deserialize the XML. If * the version is different from the expected version then it allows * the object to be deserialized in a manner that does not require * any attributes or elements, and unmatched nodes are ignored. * * @param node this is the node to read the version attribute from * @param source this is the source object that is to be written * @param schema this is the schema that contains the version */ private void writeVersion(OutputNode node, Object source, Schema schema) throws Exception { Version version = schema.getRevision(); Label label = schema.getVersion(); if(version != null) { Double start = revision.getDefault(); Double value = version.revision(); if(revision.compare(value, start)) { if(label.isRequired()) { writeAttribute(node, value, label); } } else { writeAttribute(node, value, label); } } }
/** * This method is used to write the version attribute. A version is * written only if it is not the initial version or if it required. * The version is used to determine how to deserialize the XML. If * the version is different from the expected version then it allows * the object to be deserialized in a manner that does not require * any attributes or elements, and unmatched nodes are ignored. * * @param node this is the node to read the version attribute from * @param source this is the source object that is to be written * @param schema this is the schema that contains the version */ private void writeVersion(OutputNode node, Object source, Schema schema) throws Exception { Version version = schema.getRevision(); Label label = schema.getVersion(); if(version != null) { Double start = revision.getDefault(); Double value = version.revision(); if(revision.compare(value, start)) { if(label.isRequired()) { writeAttribute(node, value, label); } } else { writeAttribute(node, value, label); } } }
Version version = context.getVersion(expect); Double start = revision.getDefault(); Double expected = version.revision();
Version version = context.getVersion(expect); Double start = revision.getDefault(); Double expected = version.revision();
Version version = context.getVersion(expect); Double start = revision.getDefault(); Double expected = version.revision();