Support for properties with capital letter on second place
See original GitHub issueThe mapper creates property names from the get- or set-method transforming the first letter to lower case.
static String toPropertyName(Method method) {
String name = method.getName();
if (isBoolGetter(method)) {
return firstCharacterToLowerCase(name.substring(2, name.length()));
} else {
if (isGetterOrSetter(method)) {
return firstCharacterToLowerCase(name.substring(3, name.length()));
} else {
throw new IllegalArgumentException("The specified method is neither a getter nor a setter method.");
}
}
}
In case of properties like ‘aProp’ with a getter ‘getAProp’ the PropertyDescripter does not convert the first character to lower case. The rule is no conversion, if the first two characters of the name are both uppercase. So the mapper failed getting the PropertyDescripter because of no matching property name and the property will be marked as invalid java bean property.
static PropertyDescriptor getPropertyDescriptorOrFail(Target target, Class<?> type, String propertyName) {
Optional<PropertyDescriptor> property;
property = Properties.getProperties(type, target)
.stream()
.filter(pd -> pd.getName()
.equals(propertyName))
.findFirst();
if (property.isPresent()) {
return property.get();
} else {
throw notAProperty(type, propertyName);
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Why does Jackson 2 not recognize the first capital letter if the ...
This does help. Curious though, in the Java Bean spec 8.8, they actually mention if the first two letter are uppercase they leave...
Read more >text-transform - CSS: Cascading Style Sheets - MDN Web Docs
The text-transform CSS property specifies how to capitalize an element's text. It can be used to make text appear in all-uppercase or ...
Read more >Capitalization Conventions - Framework Design Guidelines
Apply capitalization conventions for identifiers, compound words, and common terms. Understand how case sensitivity works in .NET.
Read more >Change lombok's property capitalization code. `Field xName ...
[BUG] When the first letter of an attribute is lowercase and the second letter is uppercase, the getter and setter methods generated by ......
Read more >Capitalization of Job Titles
The standard about capitalizing prepositions of four (or five) letters or more in composition titles is pretty widespread, I believe. It is the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It’s part of the JavaBean Specification. Here is the some extract:
https://download.oracle.com/otndocs/jcp/7224-javabeans-1.01-fr-spec-oth-JSpec/
Perfect, thanks for the quick implementation.