Use cases for implementing annotations

前端 未结 4 1764
半阙折子戏
半阙折子戏 2020-12-13 17:52

What are valid use cases for implementing annotations?

When designing primarily annotation based configuration systems I occasionally need to create classes which i

4条回答
  •  有刺的猬
    2020-12-13 18:28

    JAXBIntroductions is a good example: it allows configuring JAXB annotations using XML files. Two main use cases come to mind: configuring classes you don't have source access or different configurations for one class.

    In general, I think instantiating annotations dynamically to pass them to frameworks is generally a good use case. However, if you are the designer of this framework, I certainly would think twice though.

提交回复
热议问题