Closed danipenaperez closed 2 years ago
Hi,
Java doesn't store arguments names in java code, so there is no way we can match constructor arguments with fields. You have to match them by id or create a setter, or annotate constructor parameters.
Thanks, Daniil
And even more to this, constructor argument names not necessary match names of the fields, especially if constructor is auto-generated like in your case.
Thanks, Daniil
Using inmutable objects (only constructor +getters ) there is no simple way to use a AbstractTypeManufacturer implementation to detect the current fieldName (attributeMetadata.getAttributeName()) to customize value population.
If the Pojo Class does not contains a Setter method for a value the method attributeMetadata.getAttributeName() returns the index property at constructor (plus constructor used info).
Reproduce: Pojo inmutable class:
Try to intercept the name field to customize
The if clause never matchs because attributeMetadata.getAttributeName() returns:
2[class java.lang.Long, class java.lang.String, class java.lang.String]