Your Computer Science Resource

Posts Tagged ‘eclipse’

Dec
31st

Eclipse: Generate getters and setters

Suppose you have a relatively large class file consisting of 20 or more fields. How long will it take you to write getters and setters so that these fields may be accessed by other classes? Even a fast typist will consider this to be a very tedious task. Isn’t there some way to do this faster? Or perhaps automatically…? Alas, Eclipse can do it for us.

(more…)

Dec
31st

Eclipse: Externalize Strings

I don’t use this often, and only recently discovered this feature. Eclipse allows you to “externalize” all or specific strings in your project. This means that any string you’re using in your application can be stored in a properties file outside of your program. This essentially separates your text from the programming. Why would this be useful? Suppose you’re building an application that you want to translate into other languages. Rather than hard-code the text into your program, you can simply load up different property files depending on the language. See the potential? Now let’s see how it’s done.

(more…)