Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

marker annotations over marker interfaces

The chief advantage of marker annotations over marker interfaces is that it is
possible to add more information to an annotation type after it is already in use, by
adding one or more annotation type elements with defaults

I was reading above staemtent. I have not understood the statement, concept behind clearly.
Please advise. Any ideas, sugestions, sample code, links, resources highly appreciated. thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mick Barry
Modifying interfaces is generally not a good idea. They are strict contracts and changing them can impact on code across your application. eg. adding a new method to an interface would require all classes that mplement the interface to provide an implementation of that method.

Annotations on the other hand are more flexible, and you can add extra annotations without impacting on other areas of the code.
Avatar of gudii9

ASKER

so we can add new method to same interface with new annotation right without changing the code in parent interface, child classes right.please advise
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial