Annotations on Interfaces?

I can not identify an usage instance for having the ability to annotate user interfaces in Java.

Possibly a person could offer me an instance?

2022-07-25 20:40:16
Source Share
Answers: 4

You can utilize it for contract design shows - go one action better than simply specifying the user interface (kinds and also method names) as well as additionally specify some semiotics (materials of the kinds, prerequisites, postconditions).

I would certainly need to check out just how annotations operate in Java though, yet this things can conveniently be performed with Python annotations

2022-07-25 21:45:28

I use extensively. I find the use of to specify Nullity constraints very useful. Even if you dont actually use findbugs, it makes the intent of the code much clearer. Those annotations have their place on Interfaces as much as Classes. You could argue that it is kind of programming by contract ...

2022-07-25 21:43:50

I've seen a great deal of study devices make use of method annotations to permit customers to define methods, constraints, etc to promote automated monitoring later on.

Given that annotations do not determine what you can do with them, there is no excellent factor not to permit customers to annotate user interfaces.

2022-07-25 20:49:18

Even without instances, it needs to be clear to clarify - user interfaces define practices, therefore can annotations, so it is a sensible suit to place them with each other.

2022-07-25 20:48:09