PropertyPath类的构造函数中变量propertyName的名称似乎不符合JavaBeans规范(推断名称的8.8大写)。
// PropertyPath Code: lines 73:
PropertyPath(String name, TypeInformation<?> owningType, List<PropertyPath> base) {
...
String propertyName = name.matches(ALL_UPPERCASE) ? name : StringUtils.uncapitalize(name);
...
}该代码意味着当名称与ALL_UPPERCASE不匹配时,第一个大写字母将更改为小写。
但是JavaBeans规范说:
JavaBeans Specification
Thus when we extract a property or event name from the middle of an existing Java name,
we normally convert the first character to lower case.
However to support the occasional use of all upper-case names, we check if the first
two characters of the name are both upper case and if so leave it alone.
So for example,
“FooBah” becomes “fooBah”
“Z” becomes “z”
“URL” becomes “URL”例如:如果我在一个类中有一个名为MCount的属性,那么该属性的名称应该是符合JavaBeans规范的MCount。但是,如果我像下面这样使用PropertyPath.from来获取属性,我将得到以下异常,因为属性名称已更改为mCount。
PropertyPath property = PropertyPath.from("MCount", classType);异常: java.lang.IllegalArgumentException:无法在此ManagedType类上找到具有给定名称mCount的属性...
有谁有好的意见吗?谢谢!
发布于 2017-04-28 18:43:07
这一行为是在the commit 0c4ed8a86a中引入的,目的是修复只与所有大写属性名称相关的DATACMNS-257。
如果您认为这是一个错误,请将其归档到the issue tracker。
https://stackoverflow.com/questions/43674116
复制相似问题