开发者

Should I use Javabean property to set a characteristic or use multiple javabeans?

Is it better to use multiple javabeans that would represent different management levels of Approvers for a subordinate who requested a training class or should I have one javabean that represents an Approver object but then set a property that describes the level of this Approver?

for Example (Multiple):

public class StudentApprover1 implements Serializable {

private static final long serialVersionUID = 1L;
private String request_id;
private String student;
private String approver;
private String approver_status_code;

public class StudentApprover2 implements Serializable {

private static final long serialVersionUID = 1L;
private开发者_StackOverflow社区 String request_id;
private String student;
private String approver;
private String approver_status_code;

or (single)

public class StudentApprover implements Serializable {

private static final long serialVersionUID = 1L;
private String request_id;
private String student;
private String approver;
private String approver_level;   <---------------------- set their level 1=supervisor, 2=manager, 3=director, etc...
private String approver_status_code;


Well, they are different classes with particular logic each one or just different states of objects in the same class? It's the question that you should ask yourself.

It's cant be called 'wrong' or 'correct', but depends what that class represents in your model.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜