What are tagging interfaces and what are they used for?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Because sometimes, it really makes sense if some property of a type can be used as a type itself –
Serializablecomes to mind. If I make a method like this:… you don’t really know how that
datawill be saved. VM serialization? Bean property serialization? Some homebrewed scheme? Whereas if you write it like this:… it is quite clear (if only the designer of
ObjectOutputStreamhad used this possibility!). Sometimes it makes sense to use annotations when you want to add meta-data to types, but in this case, I’d argue for a tagging interface.