How did Java programmers survive to annotations?

Before annotating in Java, how did you achieve the same functionality?

Such a huge part of what I do every day in Java includes annotations that I cannot imagine what it would be like to program without them.

What would be an alternative way to achieve the same functionality without annotations?

+6
java annotations
source share
8 answers
  • XDoclet is basically a code generator that takes information from Java source code and custom javadoc tags.
  • Token interfaces like Serializable
  • Naming Conventions (Test Methods in JUnit)
  • And yes, a lot of XML configuration files. Be very glad that you did not have to live with them.
+4
source share

Alex, I would take XML for $ 400.

+6
source share

They are where two methods are:

  • One of them was to use XML configuration files associated with your Java classes (for example, JPA XML configuration files).
  • In some cases, when you just need a marker on a class, the marker interfaces are where they are used. Is there an interface without methods, and you can check it at run time if this object implements this interface. One fairly common pattern is Serializable .
+6
source share

Having written down a lot of xml configuration files.

+3
source share

I do not know what you mean; I do not use annotations, but here I am still alive, as always.

+3
source share

In other ways (besides XML configuration files, which probably also include the use of Spring), there will be many property files.

+3
source share
  • Properties file.
  • XML configurations
  • Text user files.
  • Interface class file with many constant fields ....
+2
source share

They are very nice features, but they create more confusion for me, as I defined them in the comments, for example. @author, @return and @deprecated, etc. I skip most of the comments and therefore it creates more confusion than convenience for me.

0
source share

All Articles