users@jaxb.java.net

Re: hasEnum & Class.forName in CodeModel

From: <HeruMartinus.Salim_at_infineon.com>
Date: Wed, 22 Nov 2006 11:13:02 +0100

Hi,

I can't easily do this.
The reason.
1. I'm gonna generate those code from the UntypedListField, an it's done
automatically by searching all the field which is of abstract class
(Port as an example)
2. So when I get this abstract class, I must find all other classes
which inherits this abstract class.

This second step cannot be done by me, because there are no model to get
all the existing classoutline to check for inheritance.

Or can we get the inherited classes from a JDefinedClass? (seems
impossible)

But I don't have any alternatives.

Best Regards,
Heru

> -----Original Message-----
> From: Aleksei Valikov [mailto:valikov_at_gmx.net]
> Sent: Tuesday, November 21, 2006 2:05 PM
> To: users_at_jaxb.dev.java.net
> Subject: Re: hasEnum & Class.forName in CodeModel
>
> Hi.
>
> > Here is the code fragment:
>
> Ok.
>
> I'd generate
>
> final Port port;
> if (type == Port.SIGNAL_PORT)
> {
> port = new SignalPort();
> }
> else if (type == Port.BUS_SLAVE_PORT)
> {
> ...
> }
> else
> {
> throw new IllegalArgumentException(...); }
>
>
> I already told you how to get enums from the class.
> Correspondence between enums and classes is your thing, you
> should know how to do it.
>
> Conditionals are done with block._if(...)._then(...)._else.
>
> You only need to define correspondence between your enums and
> classes somehow.
>
> Bye.
> /lexi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>