Use a private class instead of a anonymous class.