JavaBeans の設計方法に疑問を持っています。たとえば、次のものがあるとします。
Employee - basic employee information:
private String employee_id;
private String first_name;
private String last_name;
private String phone;
private String deptNo;
etc..
WorkflowPlayer - details about an employee in a system workflow:
private String workflow_instance_id;
private String employee_id;
private String role_class_id;
private String role_required;
private Employee employee;
private RoleClass roleClass;
RoleClass - details of a type of role (Approver, SecurityReviewer, Originator, Instructor, Manager, etc..)
private String role_class_id;
private String name;
private String label;
private String description;
これらの 3 つのモデルは、データベース テーブルにも直接対応しています (従業員は、私にとって読み取り専用のビューです)。
それから私の見解では、私は次のようなことをします
workflow_player.employee.first_name
workflow_player.roleClass.label
Employee をインスタンス変数にすることは許容されますか? または、代わりに WorkflowPlayer を Employee で拡張してから行う必要があります
workflow_player.first_name
これは従業員には意味がありますが、roleClass には意味がありません。
workflow_player.description
//いいえ!
一貫した[正しい]パターンを使用したいだけです