Hi All,
I have a problem that I�d appreciate your help in.
I�ll do my best to explain�
I have a MessageRetriever class that is used throughout the application to get messages. It is an abstract class that contains just static methods, and one static
string defining where the file is held containing the messages. In one of these methods, the static string is used.
I now have a need to retain this functionality, but to use a different file (so a different value for the static String). I defined a new class that extended MessageRetriever (WebAppMessageRetriever), and in it just have the static string defined, pointing to the new file.
When I call methods on the WebAppMessageRetriever, the methods in the superclass are correctly invoked, but the static value in the superclass is used as well, totally ignoring the value in the child class.
I think the problem is related to the methods/values being static (and so �related to the class�) and so inheritance isn�t working as expected. This is further complicated by the fact that these classes never need to be instantiated, and so no constructors are ever called (values could be passed in).
I have so far tried:
Using a static initialiser in the child to set the value
Writing get methods in both classes, thinking that the parent would call the get method in the child
Removing the definition in the parent (compilation fails).
Suggestions?
Code called in app : WebAppMessageRetriever.getMessage()
Fails due to NullPointerException (value is not defined in parent class).
Thanks in advance,
Mark G