This access strategy would be quite different from others but it would enable use cases like: - enforcing class invariants through the constructor , - immutable fields or classes (all fields) and - support for Java 10 value types which are planned to be immutable .
Parameter names (introduced in Java 8) could be used to fulfill this goal. Constructor would be used for writing entity state and for reading entity state accessors should be used. |
|