Applying static methods to data stored in a subclass
<p>I'm working on a class to access information about a class library stored in a Jar file and run actions customized for each class library. It contains methods to load localized strings, etc. from the Jar file.</p>

<pre><code>public class CodeBundle {
    public static String str(String id) {
        ...
    }

    ...
}
</code></pre>

<p>I need to be able to know which library I am trying to load information from, so I want to be able to use subclasses representing each library, for example:</p>

<pre><code>public class JAppFramework extends CodeBundle {
    ...
}
</code></pre>

<p>So now in code that is part of the JApp Framework, I want to be able to call <code>JAppFramework.str("...")</code> to load a string from the JApp Framework resource bundle. And if I have another library, such as <code>TestLibrary</code>, I want to be able to call <code>TestLibrary.str("...")</code> to load a string from Test Library's resource bundle. What I did was have a method defined in <code>CodeBundle</code> called <code>getFile()</code> which would return the Jar file from which the library had been loaded. Then the <code>str()</code> method would use that to load the localized string.</p>

<p>The problem is that the static methods in <code>CodeBundle</code> can only access data stored in the <code>CodeBundle</code> class, not in any of its subclasses, as far as I know.</p>

<p>For various reasons, I can't use "getClass().getResource(name)" to load resources.</p>

<p>Is there any way to do what I'm trying to do?</p>
