Reported by Wector11211: if a comment is set on a bean that's used in a MapProperty, the comment is repeated even if it's defined to be unique:
public class ServerSettingHolder implements SettingsHolder {
public static final Property<Map<String, ServerCollection>> SERVERS =
new MapProperty<>("",
Map.of("foo", new ServerCollection(), "bar", new ServerCollection()),
BeanPropertyType.of(ServerCollection.class));
}
public class ServerCollection {
@Comment("Comment that is present on all instances")
private List<String> servers = new ArrayList<>();
public List<String> getServers() {
return servers;
}
public void setServers(List<String> servers) {
this.servers = servers;
}
}
Problem
The mapper keeps a set of unique comments it's already used. The problem is when a bean type is used multiple times within the same property, it goes beyond the boundaries of the bean type. This not only affects MapProperty but any other collection properties where a bean property is used as type.
Solving this is a little tricky—I don't want to keep any global state, but there needs to be some mechanism to pass in a bit more state across multiple #toExportValue calls...
Reported by Wector11211: if a comment is set on a bean that's used in a MapProperty, the comment is repeated even if it's defined to be unique:
Problem
The mapper keeps a set of unique comments it's already used. The problem is when a bean type is used multiple times within the same property, it goes beyond the boundaries of the bean type. This not only affects
MapProperty
but any other collection properties where a bean property is used as type.Solving this is a little tricky—I don't want to keep any global state, but there needs to be some mechanism to pass in a bit more state across multiple #toExportValue calls...