I need a small Container-Class for storing some Strings which should be immutable. As String itself is an immutable type, I thought of something like that:
The problem is the uniform access principle. You may later need to modify foo so that it's obtained through a method instead of being fixed, and if you exposed the field instead of a getter, you'll need to break your API.