I have a singleton public class encapsulating, say, all the global methods for some speciifc math calculation. An issue with the class is that, by the very nature of the use case, there are a lots of String constants & the ways to manipulate them that would keep changing. So every 1 or 2 weeks I need to rewrite the class for new version of the constants . But this is a tedious and error prone task since the class is getting very large and I need to scan through the whole class to identify method by method which constants need changing.
I am thinking of a better way to design my class. One design I am thinking of is to extract all those String that I know is keep changing into another INNER class and expose getter to return the Strings and methods showing the new way to manipulate the String. I choose to use inner class is that those String constants are private to my singleton class i.e. no one else should be able to see them directly. But I need to make sure every new version conform to the same method signature, so the inner class must implement an interface so that when I provide my new version of the inner class of getter's I am sure I have provided all methods required by the interface.
But the problem with my design is that if my inner class implements an interface, they methods have to be public. But I don't want to expose them to everybody as they clearly are private to my singleton public class. This singleton public class is the real one to be a public class and be called by other.
So is there a better way to design my class so that I can easily inject new versions of a class without having the class made public. Just like dependency injection in Spring framework but I dont want the injected object be public class.