简体   繁体   English

获取注释的属性值(用于类,而不是方法)

[英]Get property value of annotation (used on a class, not method)

Scenario is something like below... 场景如下所示...

@Component
@Migration(description="Test Description", serial="")
public class TestUpdate1 {

}

I need to get the value of description 我需要获得描述的价值
ie "Test Description" “测试说明”

How can I do that 我怎样才能做到这一点

You can possibly get the value like this way 您可能会这样获得价值

JsonElement jsonElement = methods[i].getAnnotation(JsonElement.class);

int type = jsonElement.type();

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

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