users@jaxb.java.net

Re: JAXB plugin help

From: Geoff Ruscoe <gcruscoe_at_sigmavisions.com>
Date: Fri, 3 Nov 2006 12:32:09 -0500

Hi.


Hello :-)

> (Hoping this email attaches to the appropriate thread -- sorry for the
> > lack of history, but I wasn't subscribed)
> >
> > I am also interested in working on a plugin for JAXB to extend its
> > functionality.
> >
> > I had originally wanted to work on some new annotations to generate
> > restrictions. I hadn't thought about generating the annotations from
> > the xsd yet. I would definitely like to contribute.
>
> I'll start something this weekend.
>
> Essentially, we need to process XSOM models into annotations.
> There are two types of things to consider: structural and data validation.
>
> Plus some possibility to extend validation with custom constraints.
>
> Bye.
> /lexi
>

The two main areas I wasn't interested in working were annotations and xsd
for restrictions and enums.

Specifically restrictions on strings (regex, lengths, etc.) and adding some
new enum options.

I may be wrong about the enums, but here is a description of what I have
noticed and what I would like to add.

You can't use a Java enums with JAXB and EJB3 to represent Strings with
spaces and punctuation.

Basically I would want to have data sent through the web service map
appropriately to the column in the database.

Unfortunately, the ideal solution of:

public enum MyTest {
enumElementName("enum element name"),
cantHavePunctionation("can't have punctuation");
}

and then inside some class have:

public MyTest someStringColumnInDatabase;

Doesn't seem to work as desired. I think it wants to find the enum name in
the database rather than the textual representation of the data. I think
the same went for the JAXB representation as well -- but I'm not sure about
that. Either way I thought it would be good to be able to represent enums
for valid xsd but have the java type actually be a String so there is no
issue on the database side.

Something like:

@XmlEnumString(values={"enum element name", "can't have punctuation"})
public String someStringColumnInDatabase

Any thoughts on this? Does it sound like both of these could be good
candidates for the same plugin project? I downloaded two jaxb plugin
projects (CamelCaseAlways and Fluent). Any recommendations on a "best"
plugin I should look at to get started. Also, safe to say were using the
xsom.jar for Java 5, right? (Time to start studying up on XSOM).

Cheers.