I have the following legacy code as shown below. I'm wondering is there a way to set BikeName and BikeModel when BikeGroup is being set? Basically, as the user is setting BikeGroup, how can we automatically set Foo's version of BikeName and BikeModel? Without using a constructor to set values. I'm setting the BikeGroup using a Validator (spring framework)... so I cannot use a constructor or setter to set the values.
Class Foo{
private BikeGroup; // 1. when this is set
private String bikeName; // 2. set this with value in BikeGroup
private String bikeModel; // 3. and set this with value in BikeGroup
//getters/setters
}
Class BikeGroup{
private String bikeName;
private String bikeModel;
//getters/setters
}