OpenPojo / openpojo

POJO Testing & Identity Management Made Trivial
http://openpojo.com
Apache License 2.0
156 stars 40 forks source link

Lombok generated getters for fields with a first letter lower-case are not picked up by OpenPojo #120

Open woshilapin opened 6 years ago

woshilapin commented 6 years ago

Here is an example of a Pojo that would cause problem.

@Getter
class MyClass {
  private String aField;
}

From what I understand, Lombok will generate the method .getAField() but OpenPojo will look for a getter named .getaField() (notice the different case).

From what I can see in the code, it's made explicit (see AttributeHelper class) but I don't understand this choice (maybe there is some standard for POJOs that Lombok doesn't follow and I'm not aware of?). Is there any reason why we should keep this if clause? If yes, do you think it would be possible to make OpenPojo to check for the presence of either .getAField() or .getaField()?

Thank you for this nice library.

woshilapin commented 6 years ago

Well, I just found out the following link that kind of explain my problem: the answer seems to be "there is some standard I was not aware of". Some framework like Jackson offer the possibility to bypass that in a way (see this link). Would it be desirable to implement such a possibility?

hutumolu commented 5 years ago

It maybe useful https://stackoverflow.com/questions/30205006/why-does-jackson-2-not-recognize-the-first-capital-letter-if-the-leading-camel-c/30207335#30207335