@Override public GrapheneContext lastContext() { return CURRENT_CONTEXT.getLast(); }
@Override public Void call() throws Exception { CURRENT_CONTEXT.remove(); return null; } });
@Override public Void call() throws Exception { CURRENT_CONTEXT.set(finalContext); return null; } });
/** * Returns the value in the current browser context's copy of this * browser-local variable. If the variable has no value for the * current browser context, it is first initialized to the value returned * by an invocation of the {@link #initialValue} method. * * @return the current browser context's value of this browser-local * @throws IllegalStateException if there is no active browser context */ public T get() { BrowserActions browser = BrowserActions.currentBrowserActions(); T result = (T) browser.browserLocals.get(this); if (result == null) { T init = initialValue(); if (init != null) { browser.browserLocals.put(this, init); return init; } } return result; }
protected GrapheneContext getContext(boolean exception) { GrapheneContext context = null; if (qualifier.equals(Default.class)) { try { context = CURRENT_CONTEXT.get(); } catch (Exception ignored) { } } if (context == null || context.equals(this)) { context = ALL_CONTEXTS.get().get(qualifier); } if (context == null && exception) { throw new IllegalStateException("There is no context available for qualifier " + qualifier.getName() + ". Available contexts are " + ALL_CONTEXTS.get().keySet() + "."); } return context; }
/** * Returns the value in the current browser context's copy of this * browser-local variable. If the variable has no value for the * current browser context, it is first initialized to the value returned * by an invocation of the {@link #initialValue} method. * * @return the current browser context's value of this browser-local * @throws IllegalStateException if there is no active browser context */ public T get() { BrowserActions browser = BrowserActions.currentBrowserActions(); T result = (T) browser.browserLocals.get(this); if (result == null) { T init = initialValue(); if (init != null) { browser.browserLocals.put(this, init); return init; } } return result; }
protected GrapheneContext getContext(boolean exception) { GrapheneContext context = null; if (qualifier.equals(Default.class)) { try { context = CURRENT_CONTEXT.get(); } catch (Exception ignored) { } } if (context == null || context.equals(this)) { context = ALL_CONTEXTS.get().get(qualifier); } if (context == null && exception) { throw new IllegalStateException("There is no context available for qualifier " + qualifier.getName() + ". Available contexts are " + ALL_CONTEXTS.get().keySet() + "."); } return context; }
/** * Returns the value in the last browser context's copy of this * browser-local variable. If the variable has no value for the * last browser context, it is first initialized to the value returned * by an invocation of the {@link #initialValue} method. * * <p>If the last browser context is not available, null is returned. * * @return the last browser context's value of this browser-local */ public T getLast() { BrowserActions browser = BrowserActions.lastBrowserActions(); if (browser == null) { return null; } T result = (T) browser.browserLocals.get(this); if (result == null) { T init = initialValue(); if (init != null) { browser.browserLocals.put(this, init); return init; } } return result; }
@Override public Void call() throws Exception { CURRENT_CONTEXT.set(finalContext); return null; } });
@Override public Void call() throws Exception { CURRENT_CONTEXT.remove(); return null; } });
@Override public GrapheneContext lastContext() { return CURRENT_CONTEXT.getLast(); }
/** * Returns the value in the last browser context's copy of this * browser-local variable. If the variable has no value for the * last browser context, it is first initialized to the value returned * by an invocation of the {@link #initialValue} method. * * <p>If the last browser context is not available, null is returned. * * @return the last browser context's value of this browser-local */ public T getLast() { BrowserActions browser = BrowserActions.lastBrowserActions(); if (browser == null) { return null; } T result = (T) browser.browserLocals.get(this); if (result == null) { T init = initialValue(); if (init != null) { browser.browserLocals.put(this, init); return init; } } return result; }