Safe References to Bundle Keys on the NetBeans Platform

If you, as is normal, have this in your class, there's no way of knowing whether the key you are referring to actually exists:

Wouldn't it be much better if you could refer to a String in a Bundle class instead, i.e., instead of referring to a key in a Bundle.properties file?

Only if the String actually exists, will it be available in code completion. And if you make a typo, the file won't compile and a red error message is shown in the editor.

It's not very hard to set things up, as described in a very nice article by Edvin Syse, entitled NbBundle on Steroids Using Annotation Processors.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today