简体   繁体   中英

enforcing compile-time checking on runtime annotation

I declare an annotation that should only be used on class properties of primitive type or of java.lang.String type or when the property has been annotated with another annotation @Annot. How Do i ensure that the user does not annotate the wrong property? who do i enforce rather compile-time checking on the annotations?

You can use annotation processing for that. Unfortunately I don't have any experience to share, only this link (which may or may not be useful)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM