View Source on Github

Private Class Data

Difficulty-Beginner Idiom Java Other


Private Class Data design pattern seeks to reduce exposure of attributes by limiting their visibility. It reduces the number of class attributes by encapsulating them in single Data object.

alt text


Use the Private Class Data pattern when

  • you want to prevent write access to class data members