/** * Returns the current configuration. * First, this method peeks the inheritable thread local configuration * stack. * If no configuration has been {@link #push() pushed} yet, the global * configuration is returned. * Mind that the global configuration is shared by all threads. * * @return The current configuration. * @see #push() */ public static TConfig get() { return configs.peekOrElse(GLOBAL); }
@Override protected void onClose() { configs.popIf(this); } }
/** * Creates a new current configuration by copying the current configuration * and pushing the copy onto the inheritable thread local configuration * stack. * * @return The new current configuration. * @see #get() */ @CreatesObligation public static TConfig push() { return configs.push(new TConfig(get())); }
/** * Creates a new current configuration by copying the current configuration * and pushing the copy onto the inheritable thread local configuration * stack. * * @return The new current configuration. * @see #get() */ @CreatesObligation public static TestConfig push() { return configs.push(new TestConfig(get())); }
@Override protected void onClose() { configs.popIf(this); } }
/** * Returns the current configuration. * First, this method peeks the inheritable thread local configuration * stack. * If no configuration has been {@link #push() pushed} yet, the global * configuration is returned. * Mind that the global configuration is shared by all threads. * * @return The current configuration. * @see #push() */ public static TestConfig get() { return configs.peekOrElse(GLOBAL); }
/** * Pops the {@link #get() current configuration} off the inheritable thread * local configuration stack. * * @throws IllegalStateException If the {@link #get() current configuration} * is the global configuration. */ @DischargesObligation public static void pop() { configs.popIf(get()); }
/** * Pops the {@link #get() current configuration} off the inheritable thread * local configuration stack. * * @throws IllegalStateException If the {@link #get() current configuration} * is the global configuration. */ public static void pop() { configs.popIf(get()); }