Closed sashasch closed 1 year ago
Hi,
You use lombok and did not specify @Setter
and @Getter
, so Podam will ignore the property.
So you either should use these annotations or make a custom ClassInfoStrategy
, which will allow properties without accessors.
Note, if you do the latter it for all all classes this will likely had bad side effects.
Thanks, Daniil
Hi Daniil, First of all let me thank you for quick answer and your library doing great job overall. Unfortunately your answer in not correct. I'm using @Data annotation and it includes the both @Setter and @Getter inside. In addition, you could pay attention that the field "displayName" of the same pojo was generated normally. I have already created workaround by generating the field manually and setting it on Pojo after the library generates it, but it looks worse than if the code was working as expected.
Regards from Alex.
Hi,
Ok, I'm sorry, I overlooked couple of things here. You have @Email annotation, which we do not support and it would be filled with null.
You have to override it with calling addOrReplaceAttributeStrategy(Class<? extends Annotation>, AttributeStrategy<?>)
, but instead you call addOrReplaceAttributeStrategy(Class<?>, String, AttributeStrategy<?>)
, which won't override original mapping.
So it should be like this:
factory.getStrategy()
.addOrReplaceAttributeStrategy(
Email.class,
(AttributeStrategy<String>) (attrType, attrAnnotations) -> "dummy@mail.com");
Thanks, Daniil
For example given Pojo:
Trying to generate this:
result:
EmailContact(emailAddress=null, displayName=SHWUlQFAPF)
Tried customizing the field generation using AttributeStrategy...
, but the result was the same: