Let’s consider the following simple model
Person {
private String name;
private String country;
public void setName(String name) {this.name = name;}
public void setCountry(String country) {this.country = country;}
public String getName() {return name;}
public Optional<String> getCountry() {return Optional.ofNullable(country);}
}
Is there a way to use FieldGroup to generate a form for this type of model?
The problem is that it tries to convert Optional to a presentation type, but even if I do implement the Converter interface, the problem is that the setter does not receive a Optional parameter, but a normal String parameter.
Any suggestion on how can I handle this? (I would like to keep the Optional on the getter and not remove it or replace it with Null Object Pattern, a Optional wrapper or create a proxy for the Person model)
Thank you.