public class BrowserLocal<T> extends Object
ThreadLocal
,
BrowserActions
Constructor and Description |
---|
BrowserLocal() |
Modifier and Type | Method and Description |
---|---|
T |
get()
Returns the value in the current browser context's copy of this
browser-local variable.
|
T |
getLast()
Returns the value in the last browser context's copy of this
browser-local variable.
|
protected T |
initialValue()
Returns the current browser context's "initial value" for this
browser-local variable.
|
void |
remove()
Removes the current browser context's value for this browser-local
variable.
|
void |
set(T value)
Sets the current browser context's copy of this browser-local variable
to the specified value.
|
public T get()
initialValue()
method.IllegalStateException
- if there is no active browser contextpublic T getLast()
initialValue()
method.
If the last browser context is not available, null is returned.
protected T initialValue()
get()
method, unless the browser context previously invoked the set(T)
method, in which case the initialValue method will not
be invoked for the browser context. Normally, this method is invoked at
most once per browser context, but it may be invoked again in case of
subsequent invocations of remove()
followed by get()
.
This implementation simply returns null; if the programmer desires browser-local variables to have an initial value other than null, BrowserLocal must be subclassed, and this method overridden. Typically, an anonymous inner class will be used.
public void remove()
initialValue()
method,
unless its value is set by the current browser context
in the interim. This may result in multiple invocations of the
initialValue method in the current browser context.IllegalStateException
- if there is no active browser contextpublic void set(T value)
initialValue()
method to set the values of browser-locals.value
- the value to be stored in the current browser context's copy of
this browser-local.IllegalStateException
- if there is no active browser contextCopyright © 2013 JBoss by Red Hat. All Rights Reserved.