gpt4 book ai didi

java - 如何获取注释中其他属性的值

转载 作者:太空宇宙 更新时间:2023-11-04 07:03:18 25 4
gpt4 key购买 nike

我想获取注释范围内其他属性的值。

示例

@WebMethod(operationName = "GetBatchCount", action = NAMESPACE + getOperationName())

getOperationName() 应返回设置为 operationName 的值。

可能吗?

最佳答案

来自 JLS §9.7.1 (强调是我的)以下是元素值对中允许的组合:

The type of V is assignment compatible (§5.2) with T, and furthermore:

  • If T is a primitive type or String, and V is a constant expression (§15.28).
  • V is not null.
  • If T is Class, or an invocation of Class, and V is a class literal (§15.8.2).
  • If T is an enum type, and V is an enum constant.

因此,如您所见,值只能是某种常数。

关于java - 如何获取注释中其他属性的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21787788/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com