users@jaxb.java.net

Re: hasEnum & Class.forName in CodeModel

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Tue, 21 Nov 2006 14:05:24 +0100

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