3 ms·
Annotations are data about the code. The fact that you can't change them without recompiling the code is a feature, not a bug. If you want that kind of flexibi
by hota_mazi 10y ago
Annotations are data about the code. The fact that you can't change them without recompiling the code is a feature, not a bug.
If you want that kind of flexibility, use external files (e.g. XML) but now the two can get out of sync, which is what is commonly referred to as XML hell.
The rule of thumb is simple: whenever you need to add information about something in your source (class, method, field, package), use an annotation. If you need to add information about something that is not source code (port, host, various sizes, etc...) then use an external file. In particular, if you specify a reference to Java code in your XML, you should use an annotation instead.