For example: I have a class called Discount that holds an attribute called Type. Depending on Type value I need to compose this class or do something to represent the new field that can be declared as percent, value or fixed.
public class Discount {
private int id;
private Targer target;
private String promotionTag;
// Percent,Value,Fixed
private Type type;
private Long percent / value / fixed
}
What's the best way to design this class?
Aucun commentaire:
Enregistrer un commentaire