...
Additionally for mutable static state one can define assessor methods and add appropriate security checks. Note that in this case the scope of the static variable has been changed to private.
Code Block | ||
---|---|---|
| ||
public class MyClass { private static byte[] data; public static byte[] getData() { return data.clone(); } public static void setData(byte[] b) { securityCheck(); data = b.clone(); } } |
...