-
Notifications
You must be signed in to change notification settings - Fork 19
Description
I have been unable to figure out a way to produce a writer that allows the production of a writer for fields that do not have a getter.
The use case here is that I have an interface
interface ITtype {
Optional<String> getId();
}
and a model with that has a class that implements ITtype
(assume there's an <interface>
node in the model, please)
<field java.getter = "false">
<name>id</name>
<version>1.0.0+</version>
<required>true</required>
<description>An id</description>
<type>String</type>
</field>
and a <codeSegment>
that says (approximately)
<code>
java.util.Optional<String> getId() { return java.util.Optional.ofNullable(this.id);}
</code>
However, the Xpp3 writer distinctly uses the getter for getId()
in the writeX(
code, even though that getter doesn't exist.
It seems reasonable to make the the generator for the writer produce a reflection-based get rather than trying to use a getter that is obviously not going to exist, given the the Maven/Codehaus team's comfort with using reflection to acquire the values of locally classed private fields, especially in generated code.