It is difficult to control how data members declared public or protected data members are accessed. Attackers can manipulate such members in unexpected ways. As a result data members must be declared private {??? or package private ???}. Use wrapper accessor methods to expose class members that are to be accessed outside of the package in which their class is declared. Using wrapper methods enables appropriate monitoring and control of the modification of data members (for example, by defensive copying, validating input, and logging). The wrapper methods can preserve class invariants.
...