mardi 25 août 2020

perform update operation on a resource based on fields specified by predefined properties

I have a following requirement for my spring boot application.

  1. For example I have class :
 @Data
 class Ticket {
   private String id;
   private String description;
   private TimePeriod validity;   
 }

 @Data
 class TimePeriod {
   private OffsetDateTime issueDate;
   private OffsetDateTime endDate;
 }

  1. Given updatableData property which specifies, fields that are updatable (in case of update operation) on Ticket resource.

    updatableData="Ticket.description,Ticket.validity.*"

    where validity.* means all the fields for property TimePeriod in Ticket are updatable. ( like a wildcard ).

=> what are some better options to achieve this requirement ?

=> does this fall under use case of Spring Expression language ?

Note: My first thought was using java reflection for this purpose.





Aucun commentaire:

Enregistrer un commentaire