最近,我使用 Apache Isis 构建了我的 DDD 项目。</p>
现在,我有一个实体对象 Customer,我认为 Customer 可能有很多值对象,例如。客户联系信息。
public class Customer extends AbstractEntityObject{
@Column(allowsNull = "false")
@Getter
private String name;
@Column(allowsNull = "false")
@Getter
private String idcard;
@Column(allowsNull = "false")
@Getter
private CustomerIdType idtype;
public Customer(String name,String idcard,CustomerIdType idtype) {
this.name = name;
this.idcard = idcard;
this.idtype = idtype;
}
@Persistent(mappedBy="customer",dependentElement="false")
@Column(allowsNull="true")
@Setter @Getter
private CustomerContactInfomation contact;
}
public class CustomerContactInfomation {
@PrimaryKey
@Column(name = "customerId")
@Getter
private Customer customer;
@Column(allowsNull = "true")
@Setter @Getter
private String phone;
}
CustomerContactInfomation 只是一个值对象,它不能有任何动作,应该由客户维护。
Customer-CustomerContactInfomation 绝对是 1-1。
现在,我应该如何在 Customer 中显示 CustomerContactInfomation 并能够编辑 CustomerContactInfomation?