Hi, Ias,

before beginning, I should note that the things below reflect my private
todo list. Any other person may have different priorities. Currently I
would prefer the priorities of other people, which have an intention to
really use JM2. (Which I have not, because I am still stuck with JM1 in
project work.)


Quoting Ias <[EMAIL PROTECTED]>:

> Let me know the following items in more details:
> > 
> > - Add validation of facets like "maxLength", or "totalDigits"
> Do you mean just validation or additional support for those facets? Could
> you point me classes relevant to this mission?

Validating whether the facets are matched. For example, add

       if (pFoo.length() > 6) {
          throw new IllegalArgumentException("Length of 6 characters exceeded: "
                                             + pFoo);
       }

to setters.

The suggested implementation goes as follows:

- The interface SimpleTypeSG currently has a method:

    public JavaMethod getXMLSetMethod(JavaSource,String,String);

  The method is mainly implemented by
    
    public JavaMethod getXMLSetMethod(SimpleTypeSG,JavaSource,String,String);

  Note the additional parameter. See

    http://jaxme.sourceforge.net/JaxMeJS/docs/Patterns.html#chains

  for the rationale.

- The interface SimpleTypeSG should be extended by another method

    /** <p>Generates code verifying whether the parameter
     * <code>pValue</code> of method <code>pMethod</code> is
     * valid. A runtime exception is thrown otherwise. Used
     * to generate the "set" and "add" methods.</p>
     */
    public void addValidation(JavaMethod pMethod, DirectAccessible pValue);

  Note that you have to rerun the ant target "precompile" to update the
  interface SimpleTypeSGChain.

- Add code to the implementation which invokes the method.

- Implement this method in the various concrete type implementations
  like StringTypeSG, and so on. For examples on how to verify whether
  a facet is set, you can take a look at ParserTest.testNegativeInteger()
  and similar methods.


> > - Add support for "isSet" methods

The PropertySG currently has a method hasIsSetMethod() which is always
returning false. The returned value should be based on

    JAXBProperty.isGenerateIsSetMethod()

The PropertySG also needs to have additional methods

    getXMLIsSetMethodName
    getXMLSetMethodName

which ought to be implemented roughly like

    getXMLSetMethodName
    getXMLSetMethod

Both methods should be able to return null, if hasIsSetMethod() returns
false.


> > - Add support for "simpleContent" (Mostly done, mainly 
> > requires writing of
> >   a unit test)

Add an example schema with simple content to the examples/misc directory.
Extend the MarshallerTest with code marshalling and unmarshalling an
instance.

The test will most probably fail, because serialization and unmarshalling
is not completely implemented. Serialization works by adding code for
invoking the characters() nethod of the SAX content handler. Unmarshalling
works by creating an instance of AtomicHandler.


> > - Add support for recursion (Mostly done, mainly requires writing of a
> >   unit test)

Extend the ParserTest with code parsing a recursive element definition.
I expect this to work immediately.

Create a recursive element definition in the examples/misc directory and
add extend the MarshallerTest with code marshalling and unmarshalling an
instance.


> > - Add support for collectionType="indexed" (Changes in 
> > MultiplePropertySG
> >   and ListTypeSG, plus adding a unit test)
> >

The class MuliplePropertySG is responsible for the handling of elements
with maxOccurs > 0. Currently the implementation will always generate a
method

    public List getFoo();

The "foo" list may be modified by the user. The List implementation is
choosen by

    JAXBProperty.getCollectionType();

If the collectionType is "indexed", then the class should rather create
typesafe methods like

    public Foo[] getFoo();
    public void addFoo(Foo pFoo);
    public void clearFoo();
    public void setFoo(Foo[]);

(Details should of course follow the JAXM RI.)


Jochen



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
_______________________________________________
Jaxme-jaxb-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxme-jaxb-dev

Reply via email to