java - 当其他字段具有特定值时需要注释字段
问题描述
如果我有这样定义的字段注释:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface LineField {
public int at();
public int length();
public String literal() default "[unassigned]";
public boolean isId() default false;
}
当 'isId' 设置为 true 时,api 本身是否有可能让 'literal' 不是可选的,
例子 :
//Valid
@LineField(at = 0, length = 1, isId = true, literal = "6")
private String recordTypeCode;
//Invalid
@LineField(at = 0, length = 1, isId = true)
private String recordTypeCode;
解决方案
推荐阅读
- c# - IC# treeView 显示文件夹序列节点如何重命名节点在表单加载时循环而不更改源文件夹名称
- mysql - 从今天开始按一年中的某一天排序,然后循环到昨天
- javascript - 是否有一种简单的方法可以从数组中获取某个元素并将该元素放在最后一个位置?
- javascript - 如何在 NodeJS 中正确地要求文件?
- java - 具有类型参数的泛型类 E 是 E 的子类
- graphql - Gatsby Graphql 构建查询找不到我的图像,但 GraphQL IDE 可以
- iframe - Bootstrap 4 模态叠加层未通过 Iframe 在视口中居中显示
- log4j - 在带有时间戳的文本文件中创建 MLCP 日志
- scala - Spark和scala:链接函数if
- reactjs - 为什么我的 redux 表单中没有显示该值?