users@jaxb.java.net

Custom interfaces

From: Marek Malowidzki <maom_onet_at_poczta.onet.pl>
Date: Fri, 29 Nov 2002 10:07:03 +0100

Hi all,

I have a question regarding using custom Java interfaces in the recent JAXB
implementation. I believe that this answer could have been already answered, but
I failed twice to register to be able to search the archives (did anyone
success?).

In the early access release, there was a nice feature that allowed to declare
custom interfaces to be implemented by generated content Java interfaces. For
example, it could be done using:

<interface name="BasicColumnTemplate" members="ColumnTemplate
ColumnImportTemplate" properties="name label prompt description reference
[...]"/>

This feature disappeared and there does not seem to be any replacement (or am I
missing something?). The problem is that when I have two elements with a similar
subsert of sub-elements and attributes, often I would like to be able to group
the common features in an interface. For elements, it could be (partially,
because of the order in which the elements appear) solved by using groups with
modelGroupAsClass="true" (however, the current RI does not support this
feature). But for attributes I cannot see a possible (elegant) solution - groups
can't contain attributes.

The solution I am using is to include in the schema some artificial types
grouping these common features. Then, after the content classes have been
generated, I manually extend the generated interfaces with the "artificial"
ones. Quite ugly and error-prone, but is there a better solution.

The second question: It is not possible anymore to find out if attribute's value
has been provided in an instance document (the hasXXX() methods from the early
release version). Is this true?

Best regards and thanks for the help.

Marek