Supposed I have a class like the following
public class Foo
{
public static final String FIELD_1 = Env.getProperties("one");
public static final String FIELD_2 = Env.getProperties("one");
//....
public static final String FIELD_N = Env.getProperties("n");
}
Obviously, all the FIELD_*
get populated when we first reference Foo
.
Suppose my Env.getProperties(String)
is not purely functional (ie., it could return different values. How? Not important here)
How do I force the class Foo
to be "reloaded", so that all the class-init code is re-excecuted (just so I could have different values for the static fields)?
(For various reason, I can't make these fields non-static or non-final. So please don't suggest solutions like make Foo an interface, with various getter-methods to be overriden)
Thanks