dev@jaxb.java.net

Re: Added functionality for code_injector/PluginImpl.java

From: Iaroslav Savytskyi <iaroslav.savytskyi_at_oracle.com>
Date: Tue, 9 Sep 2014 14:19:07 +0200

Hi Karsten,

Thank you for your report.

The common way how to do code changes is to fire bug on Jira ( https://java.net/jira/browse/JAXB ).
You can propose code changes there. Meantime you have to sign Oracle Contribution Agreement. So we will be able to work with your patch.

[1]: http://www.oracle.com/technetwork/oca-405177.pdf
[2]: http://www.oracle.com/technetwork/oca-faq-405384.pdf


Best regards.
Yarda

On 9 Sep 2014, at 13:38, <kengelke_at_gmail.com> <kengelke_at_gmail.com> wrote:

> Hi,
>
> I noticed that the current code injection plugin doesn't allow to
> inject code into enums. This is due to the plugin only iterating over
> getClasses() and not getEnums(). A very simple addition would add
> support for code injection in enums:
>
> for (EnumOutline eo : model.getEnums()) {
> CPluginCustomization c =
> eo.target.getCustomizations().find(Const.NS, "code");
> if (c == null) {
> continue; // no customization --- nothing to inject
> here
> }
>
> c.markAsAcknowledged();
> // TODO: ideally you should validate this DOM element to
> make sure
> // that there's no typo/etc. JAXP 1.3 can do this very
> easily.
> String codeFragment = DOMUtils.getElementText(c.element);
>
> // inject the specified code fragment into the
> implementation class.
> eo.clazz.direct(codeFragment);
> }
>
> Please let me know if there is proper way to propose code changes.
>
>
> Regards,
>
> Karsten