简体   繁体   English

对运行时批注执行编译时检查

[英]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. 我声明了一个注释,该注释仅应在原始类型或java.lang.String类型的类属性上使用,或者在该属性已被另一个注释@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) 不幸的是,我没有任何经验可分享,只有此链接 (可能有用或可能没有用)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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