Exemplo n.º 1
0
  public TestDescriptorDescriptor() {
    super();
    nsURI = "http://castor.exolab.org/Test";
    xmlName = "TestDescriptor";

    // -- set grouping compositor
    setCompositorAsSequence();
    XMLFieldDescriptorImpl desc = null;
    XMLFieldHandler handler = null;
    FieldValidator fieldValidator = null;
    // -- initialize attribute descriptors

    // -- initialize element descriptors

    // -- _name
    desc = new XMLFieldDescriptorImpl(java.lang.String.class, "_name", "Name", NodeType.Element);
    desc.setImmutable(true);
    handler =
        (new XMLFieldHandler() {
          public java.lang.Object getValue(java.lang.Object object) throws IllegalStateException {
            TestDescriptor target = (TestDescriptor) object;
            return target.getName();
          }

          public void setValue(java.lang.Object object, java.lang.Object value)
              throws IllegalStateException, IllegalArgumentException {
            try {
              TestDescriptor target = (TestDescriptor) object;
              target.setName((java.lang.String) value);
            } catch (Exception ex) {
              throw new IllegalStateException(ex.toString());
            }
          }

          public java.lang.Object newInstance(java.lang.Object parent) {
            return null;
          }
        });
    desc.setHandler(handler);
    desc.setNameSpaceURI("http://castor.exolab.org/Test");
    desc.setRequired(true);
    desc.setMultivalued(false);
    addFieldDescriptor(desc);

    // -- validation code for: _name
    fieldValidator = new FieldValidator();
    fieldValidator.setMinOccurs(1);
    { // -- local scope
      StringValidator sv = new StringValidator();
      sv.setWhiteSpace("preserve");
      fieldValidator.setValidator(sv);
    }
    desc.setValidator(fieldValidator);

    // -- _author
    desc =
        new XMLFieldDescriptorImpl(java.lang.String.class, "_author", "Author", NodeType.Element);
    desc.setImmutable(true);
    handler =
        (new XMLFieldHandler() {
          public java.lang.Object getValue(java.lang.Object object) throws IllegalStateException {
            TestDescriptor target = (TestDescriptor) object;
            return target.getAuthor();
          }

          public void setValue(java.lang.Object object, java.lang.Object value)
              throws IllegalStateException, IllegalArgumentException {
            try {
              TestDescriptor target = (TestDescriptor) object;
              target.setAuthor((java.lang.String) value);
            } catch (Exception ex) {
              throw new IllegalStateException(ex.toString());
            }
          }

          public java.lang.Object newInstance(java.lang.Object parent) {
            return null;
          }
        });
    desc.setHandler(handler);
    desc.setNameSpaceURI("http://castor.exolab.org/Test");
    desc.setRequired(true);
    desc.setMultivalued(false);
    addFieldDescriptor(desc);

    // -- validation code for: _author
    fieldValidator = new FieldValidator();
    fieldValidator.setMinOccurs(1);
    { // -- local scope
      StringValidator sv = new StringValidator();
      sv.setWhiteSpace("preserve");
      fieldValidator.setValidator(sv);
    }
    desc.setValidator(fieldValidator);

    // -- _commentList
    desc =
        new XMLFieldDescriptorImpl(
            java.lang.String.class, "_commentList", "Comment", NodeType.Element);
    desc.setImmutable(true);
    handler =
        (new XMLFieldHandler() {
          public java.lang.Object getValue(java.lang.Object object) throws IllegalStateException {
            TestDescriptor target = (TestDescriptor) object;
            return target.getComment();
          }

          public void setValue(java.lang.Object object, java.lang.Object value)
              throws IllegalStateException, IllegalArgumentException {
            try {
              TestDescriptor target = (TestDescriptor) object;
              target.addComment((java.lang.String) value);
            } catch (Exception ex) {
              throw new IllegalStateException(ex.toString());
            }
          }

          public java.lang.Object newInstance(java.lang.Object parent) {
            return null;
          }
        });
    desc.setHandler(handler);
    desc.setNameSpaceURI("http://castor.exolab.org/Test");
    desc.setRequired(true);
    desc.setMultivalued(true);
    addFieldDescriptor(desc);

    // -- validation code for: _commentList
    fieldValidator = new FieldValidator();
    fieldValidator.setMinOccurs(1);
    { // -- local scope
      StringValidator sv = new StringValidator();
      sv.setWhiteSpace("preserve");
      fieldValidator.setValidator(sv);
    }
    desc.setValidator(fieldValidator);

    // -- _category
    desc =
        new XMLFieldDescriptorImpl(
            org.exolab.castor.tests.framework.testDescriptor.types.CategoryType.class,
            "_category",
            "Category",
            NodeType.Element);
    handler =
        (new XMLFieldHandler() {
          public java.lang.Object getValue(java.lang.Object object) throws IllegalStateException {
            TestDescriptor target = (TestDescriptor) object;
            return target.getCategory();
          }

          public void setValue(java.lang.Object object, java.lang.Object value)
              throws IllegalStateException, IllegalArgumentException {
            try {
              TestDescriptor target = (TestDescriptor) object;
              target.setCategory(
                  (org.exolab.castor.tests.framework.testDescriptor.types.CategoryType) value);
            } catch (Exception ex) {
              throw new IllegalStateException(ex.toString());
            }
          }

          public java.lang.Object newInstance(java.lang.Object parent) {
            return null;
          }
        });
    desc.setHandler(
        new EnumFieldHandler(
            org.exolab.castor.tests.framework.testDescriptor.types.CategoryType.class, handler));
    desc.setImmutable(true);
    desc.setNameSpaceURI("http://castor.exolab.org/Test");
    desc.setRequired(true);
    desc.setMultivalued(false);
    addFieldDescriptor(desc);

    // -- validation code for: _category
    fieldValidator = new FieldValidator();
    fieldValidator.setMinOccurs(1);
    desc.setValidator(fieldValidator);

    // -- _bugFix
    desc = new XMLFieldDescriptorImpl(BugFix.class, "_bugFix", "BugFix", NodeType.Element);
    handler =
        (new XMLFieldHandler() {
          public java.lang.Object getValue(java.lang.Object object) throws IllegalStateException {
            TestDescriptor target = (TestDescriptor) object;
            return target.getBugFix();
          }

          public void setValue(java.lang.Object object, java.lang.Object value)
              throws IllegalStateException, IllegalArgumentException {
            try {
              TestDescriptor target = (TestDescriptor) object;
              target.setBugFix((BugFix) value);
            } catch (Exception ex) {
              throw new IllegalStateException(ex.toString());
            }
          }

          public java.lang.Object newInstance(java.lang.Object parent) {
            return new BugFix();
          }
        });
    desc.setHandler(handler);
    desc.setNameSpaceURI("http://castor.exolab.org/Test");
    desc.setMultivalued(false);
    addFieldDescriptor(desc);

    // -- validation code for: _bugFix
    fieldValidator = new FieldValidator();
    desc.setValidator(fieldValidator);

    // -- _testDescriptorChoice
    desc =
        new XMLFieldDescriptorImpl(
            TestDescriptorChoice.class,
            "_testDescriptorChoice",
            "-error-if-this-is-used-",
            NodeType.Element);
    handler =
        (new XMLFieldHandler() {
          public java.lang.Object getValue(java.lang.Object object) throws IllegalStateException {
            TestDescriptor target = (TestDescriptor) object;
            return target.getTestDescriptorChoice();
          }

          public void setValue(java.lang.Object object, java.lang.Object value)
              throws IllegalStateException, IllegalArgumentException {
            try {
              TestDescriptor target = (TestDescriptor) object;
              target.setTestDescriptorChoice((TestDescriptorChoice) value);
            } catch (Exception ex) {
              throw new IllegalStateException(ex.toString());
            }
          }

          public java.lang.Object newInstance(java.lang.Object parent) {
            return new TestDescriptorChoice();
          }
        });
    desc.setHandler(handler);
    desc.setContainer(true);
    desc.setClassDescriptor(new TestDescriptorChoiceDescriptor());
    desc.setNameSpaceURI("http://castor.exolab.org/Test");
    desc.setRequired(true);
    desc.setMultivalued(false);
    addFieldDescriptor(desc);

    // -- validation code for: _testDescriptorChoice
    fieldValidator = new FieldValidator();
    fieldValidator.setMinOccurs(1);
    desc.setValidator(fieldValidator);
  } // -- org.exolab.castor.tests.framework.testDescriptor.TestDescriptorDescriptor()
Exemplo n.º 2
0
  public ComplexTypeTaxonDescriptor() {
    super();
    _nsURI = "http://ltsc.ieee.org/xsd/LOM";
    _xmlName = "taxon";
    _elementDefinition = false;

    // -- set grouping compositor
    setCompositorAsSequence();
    org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
    org.exolab.castor.mapping.FieldHandler handler = null;
    org.exolab.castor.xml.FieldValidator fieldValidator = null;
    // -- initialize attribute descriptors

    // -- initialize element descriptors

    // -- _id
    desc =
        new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
            es.pode.parseadorXML.castor.Id.class,
            "_id",
            "-error-if-this-is-used-",
            org.exolab.castor.xml.NodeType.Element);
    handler =
        new org.exolab.castor.xml.XMLFieldHandler() {
          public java.lang.Object getValue(java.lang.Object object) throws IllegalStateException {
            ComplexTypeTaxon target = (ComplexTypeTaxon) object;
            return target.getId();
          }

          public void setValue(java.lang.Object object, java.lang.Object value)
              throws IllegalStateException, IllegalArgumentException {
            try {
              ComplexTypeTaxon target = (ComplexTypeTaxon) object;
              target.setId((es.pode.parseadorXML.castor.Id) value);
            } catch (java.lang.Exception ex) {
              throw new IllegalStateException(ex.toString());
            }
          }

          public java.lang.Object newInstance(java.lang.Object parent) {
            return new es.pode.parseadorXML.castor.Id();
          }
        };
    desc.setHandler(handler);
    desc.setContainer(true);
    desc.setClassDescriptor(new es.pode.parseadorXML.castor.descriptors.IdDescriptor());
    desc.setNameSpaceURI("http://ltsc.ieee.org/xsd/LOM");
    desc.setRequired(true);
    desc.setMultivalued(false);
    addFieldDescriptor(desc);

    // -- validation code for: _id
    fieldValidator = new org.exolab.castor.xml.FieldValidator();
    fieldValidator.setMinOccurs(1);
    { // -- local scope
    }
    desc.setValidator(fieldValidator);
    // -- _entryTaxon
    desc =
        new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
            es.pode.parseadorXML.castor.EntryTaxon.class,
            "_entryTaxon",
            "-error-if-this-is-used-",
            org.exolab.castor.xml.NodeType.Element);
    handler =
        new org.exolab.castor.xml.XMLFieldHandler() {
          public java.lang.Object getValue(java.lang.Object object) throws IllegalStateException {
            ComplexTypeTaxon target = (ComplexTypeTaxon) object;
            return target.getEntryTaxon();
          }

          public void setValue(java.lang.Object object, java.lang.Object value)
              throws IllegalStateException, IllegalArgumentException {
            try {
              ComplexTypeTaxon target = (ComplexTypeTaxon) object;
              target.setEntryTaxon((es.pode.parseadorXML.castor.EntryTaxon) value);
            } catch (java.lang.Exception ex) {
              throw new IllegalStateException(ex.toString());
            }
          }

          public java.lang.Object newInstance(java.lang.Object parent) {
            return new es.pode.parseadorXML.castor.EntryTaxon();
          }
        };
    desc.setHandler(handler);
    desc.setContainer(true);
    desc.setClassDescriptor(new es.pode.parseadorXML.castor.descriptors.EntryTaxonDescriptor());
    desc.setNameSpaceURI("http://ltsc.ieee.org/xsd/LOM");
    desc.setRequired(true);
    desc.setMultivalued(false);
    addFieldDescriptor(desc);

    // -- validation code for: _entryTaxon
    fieldValidator = new org.exolab.castor.xml.FieldValidator();
    fieldValidator.setMinOccurs(1);
    { // -- local scope
    }
    desc.setValidator(fieldValidator);
  }