final JFieldVar field = f.parent().implClass.field( JMod.PROTECTED, f.parent().parent().getCodeModel().ref(
"java.util.Calendar" ), "jpa" + f.getPropertyInfo().getName( true ) );
field.annotate( XmlTransient.class );
final JMethod getter =
f.parent().implClass.method( JMod.PUBLIC, f.parent().parent().getCodeModel().ref( Calendar.class ),
"getJpa" + f.getPropertyInfo().getName( true ) );
getter.body().directStatement( "// " + getMessage( "title" ) );
getter.body().assign( JExpr.refthis( field.name() ), f.parent()._package().objectFactory().
staticInvoke( "createCalendar" ).arg( JExpr.refthis( f.getPropertyInfo().getName( false ) ) ) );
getter.body()._return( JExpr.refthis( field.name() ) );
getter.javadoc().append(
"Gets the value of the jpa" + f.getPropertyInfo().getName( true ) + " property." + lineSeparator );
getter.javadoc().append(
"<p>This method returns the value of the " + f.getPropertyInfo().getName( false ) + " property "
+ "transformed to a " + Calendar.class.getName() + " instance.</p>" + lineSeparator );
getter.javadoc().addReturn().append(
"The value of the jpa" + f.getPropertyInfo().getName( true ) + " property." );
// Setter.
final JMethod setter = f.parent().implClass.method(
JMod.PUBLIC, f.parent().parent().getCodeModel().VOID, "setJpa" + f.getPropertyInfo().getName( true ) );
final JVar calendar = setter.param( JMod.FINAL, Calendar.class, "value" );
setter.body().directStatement( "// " + getMessage( "title" ) );
setter.body().assign( JExpr.refthis( field.name() ), calendar );
setter.body().assign( JExpr.refthis( f.getPropertyInfo().getName( false ) ), f.parent()._package().
objectFactory().staticInvoke( "createXMLGregorianCalendar" ).arg( calendar ) );
// Update to the JAXB property setter to also update the jpa field.
final JMethod transientSetter = this.getSetter( f );
transientSetter.body().assign( JExpr.refthis( field.name() ), f.parent()._package().objectFactory().
staticInvoke( "createCalendar" ).arg( transientSetter.listParams()[0] ) );
setter.javadoc().append(
"Sets the value of the jpa" + f.getPropertyInfo().getName( true ) + " property." + lineSeparator );
setter.javadoc().append(