dimanche 10 mai 2020

Is there any way to map jsonProperty of nested fields within an object?

I have two classes Car.java and Bus.java

        Car.java   
        private Property property;
       Bus.java
       private Property property;

The Property.java class has number and colour.

        Property.java
        private String number;
        private String colour;

Depending on where it is called from, Car.java or Bus.java ,I want the properties field to be called carNumber, carColour, busNumber, busColour respectively in the output json.

Is there any way to achieve this using a single property class?

Aucun commentaire:

Enregistrer un commentaire