Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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
bgColor#ccccff
public class MyClass {

    private static byte[] data;
    public static byte[] getData() {
        return data.clone();
    }

    public static void setData(byte[] b) {
        securityCheck();
       data = b.clone();
    }
}

...