users@jaxb.java.net

Re: XSD Data types

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Tue, 14 Nov 2006 12:47:15 +0100

Hi.

>> I think I need to learn a lot of things. :-) Great...
>> 1 more question.
>> Can I add an import statement on the generated code? Because I inject
>> a code to my generated Code using co.implClass.direct() API, which
>> containing util classes such as Iterator, List, etc. And maybe would
>> like to add few more classes. Or maybe is there any better way to
>> inject code?
>
> Lexi: I generally dislike direct() code generation.
>
> Heru: What are the other alternatives?

Well, if you have your code defined in a String, there's no alternative. I just
prefer using normal CodeModel API instead of direct statements where it's possible.
Say, you can direct("a=b;"), you can body.assign(a, b);

> Lexi: As far as I know, you can't explicitly defined an import statement
> - seems like you'll need to use FQ class names.
>
> Heru: What is that FQ class names? How can I use it?

Fully qualified class names. You have to write java.util.List instead of List in
your injected code.

Bye.
/lexi