dev@jaxb.java.net

Re: How to generate an abstract class with JAXB?

From: Pavel Bucek <Pavel.Bucek_at_Sun.COM>
Date: Wed, 26 Nov 2008 12:31:14 +0100

Hi again,

no, it can't be done with standard jaxb bindigs. You may be able to do
it by writing custom plugin (I'm not sure about it).

Good start for writing xjc plugin is Koshukes blog:
http://weblogs.java.net/blog/kohsuke/archive/2005/06/writing_a_plugi.html .

Hope this helps.

Pavel

alisamad wrote:
> Hi,
>
> Thanks for the reply that looks like a clean solution. But what if I can't
> edit the schema, can this be done in an external binding file?
>
>
> Thanks,
>
>
>
> Pavel Bucek wrote:
>
>> Hello,
>>
>> if you can edit schema, try something like this:
>>
>> <xs:complexType name="abstrClass" abstract="true">
>> <xs:sequence>
>> <xs:element name="field1" type="xs:int" />
>> <xs:element name="field2" type="xs:int" />
>> </xs:sequence>
>> </xs:complexType>
>>
>> and
>>
>> public abstract class AbstrClass { .. }
>>
>> will be generated.
>>
>>
>> Pavel
>>
>>
>> alisamad wrote:
>>
>>> Hi I have posted this question somewhere, so I am gonna try here as well.
>>>
>>> I have a schema file and I would like to generate a class which would be
>>> an
>>> abstract class
>>> i.e the generated class would look like this:
>>>
>>> public abstract class MyClass {
>>> .....
>>> }
>>>
>>> Can it be done with an annotation or with an external binding file?
>>>
>>> many thanks,
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: dev-help_at_jaxb.dev.java.net
>>
>>
>>
>>
>
>