Tag Archives: Reversed Engineering

Java Architecture in Eclipse

evertwagenaar.com logo

Using Ecipse for Reversed Engineering

Eclipse is one of the most popular IDE’s. In this article we will use Eclipse to investigate an existing class from the java.text package. The class we will investigate is the DateFormat.

DateForma is an abstract class for date/time formatting subclasses which formats and parses dates or time in a language-independent manner. The date/time formatting subclass, such as SimpleDateFormat, allows for formatting (i.e., date -> text), parsing (text -> date), and normalization. The date is represented as a Date object or as the milliseconds since January 1, 1970, 00:00:00 GMT.
DateFormat provides many class methods for obtaining default date/time formatters based on the default or a given locale and a number of formatting styles. The formatting styles include FULL, LONG, MEDIUM, and SHORT. More detail and examples of using these styles are provided in the method descriptions.

DateFormat helps you to format and parse dates for any locale. Your code can be completely independent of the locale conventions for months, days of the week, or even the calendar format: lunar vs. solar. Browsing the JavaDoc is always fun. But even more fun is firing up your IDE and have a look. So let’s do so!

Eclipse with DateFormat Chosen.
Eclipse with DateFormat Chosen.

With DateFormat chosen in the TypeHierachy I can see it inherits directly from an Abstract class named Format. (You recognize the Abstract Class by the small A in it’s upper-right corner. As you can see DateFormat is Abstract itself.

Now zoom in on the DateFormat to get the full type hierarchy:

As you can see, SimpleDateFormat inherits from DateFormat, which in turn Inherits from Format, which (like any other Object) inherits from Object.

Conclusion

Eclipse is an excellent tool to study existing Java Classes and their hyrarchie in comparison with other classes. You can also use this to investigate (chains of) method calls by selecting a method and choose ‘Call hierarchy’. Try this yourself and enjoy it!