Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How did Java programmers survive before annotations? [closed]

Before the introduction of annotations in Java, how was the same functionality achieved?

Such a huge portion of what I do every day in Java involves annotations that I can't imagine what it would be like to program without them.

What would be an alternative way of achieving the same functionality without annotations?

like image 838
Dieter Gantz Avatar asked Sep 22 '10 13:09

Dieter Gantz


Video Answer


2 Answers

Alex, I would take XML for $400.

like image 59
Alexander Pogrebnyak Avatar answered Sep 21 '22 06:09

Alexander Pogrebnyak


They where two techniques:

  • One was to use XML configuration files, related to your Java classes (an example is JPA XML configuration files).
  • In some cases, where your just needed a marker on a class, marker interfaces where used. Is consists in having an interface with no methods, and you can check at runtime if a given object implements this interface. One pretty common sample is Serializable.
like image 43
Vivien Barousse Avatar answered Sep 20 '22 06:09

Vivien Barousse