I would like to customize generation of a Openl Datatype in order to get a class file with @XmlJavaTypeAdapter annotation on a date field. The goal is to have a date format yyyy-MM-dd only for
this date field .
Hello,
Customization of the requests and the responses for generated datatypes via MixIn classes feature was implemented OpenL 5.23.3.
You should have an abstract class, where the getters from generated class needs are described, and then add necessary annotations.
See an example:
@MixInClass("org.openl.generated.beans.Customer")
public abstract class CustomerMixIn {
This class should be applied via rules-deploy.xml configuration file:
<configuration>
<entry>
<string>rootClassNamesBinding</string>
<string>org.example.custom.mixin.CustomerMixIn</string>
</entry>
</configuration>
Best Regards,
Alena.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you want only to customize date format for all date fields in all datatypes in a service you can to apply following configuration via rules-deploy.xml:
Hello,
I would like to customize generation of a Openl Datatype in order to get a class file with @XmlJavaTypeAdapter annotation on a date field. The goal is to have a date format yyyy-MM-dd only for
this date field .
Example :
Thank you in advance
Hello,
Customization of the requests and the responses for generated datatypes via MixIn classes feature was implemented OpenL 5.23.3.
You should have an abstract class, where the getters from generated class needs are described, and then add necessary annotations.
See an example:
@MixInClass("org.openl.generated.beans.Customer")
public abstract class CustomerMixIn {
}
This class should be applied via rules-deploy.xml configuration file:
<configuration>
<entry>
<string>rootClassNamesBinding</string>
<string>org.example.custom.mixin.CustomerMixIn</string>
</entry>
</configuration>
Best Regards,
Alena.
Hi Alena,
Great !!! Thank you for you support.
Have a nice day
Kamal.
Hi Kamal RAIMI,
If you want only to customize date format for all date fields in all datatypes in a service you can to apply following configuration via rules-deploy.xml:
Date format should be compatible with Java Simple date format: https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
If you want mix different date formats in datatype fields then please, use @MixInClass annotations.
FYI, if @MixInClass is used then system doesn't generate WADL for the service, but swagger schemas works well.
Thanks, Marat Kamalov.
if jackson.defaultDateFormat doesn't work please try jacksondatabinding.defaultDateFormat. It was renamed recently.