Zdravím Tomáši,

so 16. 1. 2021 v 15:57 odesílatel Tomáš Procházka <[email protected]> napsal:

> Hi,
>
> there are two ways how NbBundle is used in NetBeans sources.
>
> The first one uses @NbBundle.Messages annotation in combination with
> method Bundle.method_from_message_key().This way seems to be used in
> newer code.
>

Right. Newer style is used in newer code. It is inherently more type-safe.
If you make a typo in the key name, your code fails to compile. If you
forget to pass an argument when composing message for given key, you should
get an error as well. If you use "# {0} - ...." comments, then you also get
a code completion hints when calling into the generated key method.

The new style is using the old one behind the scene. E.g. functionally they
should be identical. Only the comfort mentioned above is the differentiator.

Feel free to update Javadoc to make it clearer at places where you'd expect
such information.
-jt


>
> The second one uses method NbBundle.getMessage(class, messageKey).
>
> What is the difference between these two usages?
>
> Regads,
>
> Tom
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
>

Reply via email to