@Test public void unlock() { final Config config = buildConfig("secret", "12345678", "not.secret", "value"); SecretKeys.doUnlocked(() -> assertEquals("12345678", config.getValue("secret", String.class))); assertEquals("12345678", SecretKeys.doUnlocked(() -> config.getValue("secret", String.class))); assertThrows(SecurityException.class, () -> config.getValue("secret", String.class), "Not allowed to access secret key secret"); }
public static void doUnlocked(Runnable runnable) { doUnlocked(() -> { runnable.run(); return null; }); }
SecretKeys { public static void doUnlocked(Runnable runnable) { doUnlocked(() -> { runnable.run(); return null; }); } }
SecretKeys { public static void doUnlocked(Runnable runnable) { doUnlocked(() -> { runnable.run(); return null; }); } private  SecretKeys(); }
SecretKeys { public static void doUnlocked(Runnable runnable) { doUnlocked(() -> { runnable.run(); return null; }); } private  SecretKeys(); static boolean isLocked(); static void doUnlocked(Runnable runnable); static T doUnlocked(Supplier<T> supplier); static void doLocked(Runnable runnable); static T doLocked(Supplier<T> supplier); }
SecretKeys { public static void doUnlocked(Runnable runnable) { doUnlocked(() -> { runnable.run(); return null; }); } private  SecretKeys(); static boolean isLocked(); static void doUnlocked(Runnable runnable); static T doUnlocked(Supplier<T> supplier); static void doLocked(Runnable runnable); static T doLocked(Supplier<T> supplier);  }