I have a base class that I want to convert. All the types I want to convert to are identical to each other, except for the package name. They're created in specs I have no control over. Is there a way of creating a generic converter, so I'm not repeating identical get and set calls over and over? Mine are obviously more complex than the ones below, but the point I'm highlighting is that the field names differ between the original and final types.
Original:
com.mycompany.base.ConvertMe;
class ConvertMe {
private String name;
private String colour;
private String fruit;
//getters and setters...
}
Needs to map to:
com.mycompany.convertedA;
class Result {
private String firstName;
private String favouriteColour;
private String favouriteFruit;
//getters and setters...
}
And also map to:
com.mycompany.convertedB;
class Result {
private String firstName;
private String favouriteColour;
private String favouriteFruit;
//getters and setters...
}