Generally member fields should be accessed via getters and setter.
In this particular case the purpose of the metrics holder class (such as RPCMetrics or NameNodeMetrics, etc is to be place holder
of the a list of metrics variables that are then accessed in various parts of the code to change the counters.
Forcing a set of new methods per metrics (since a metrics may have multiple operations) is very painful and will make it
harder to add new metrics. Adding metrics should be simple"
- declare metrics variable (eg. counter)
- write code to change the metrics variable (e.g inc the counter).
HADOOP-4838 simplifies metrics so that only the above two steps are needed.)
I believe the metrics variables are one of the exception to style rule of using getters and setter for fields.
(Note HADOOP4848 has added a registry and hence it would be easy to have the callers use that map but the cost of that
would be too much for changing counters (ie a map lookup operation per counter increment!!)