Top Description Methods
org.wildfly.common.context

public Interface Contextual<C extends org.wildfly.common.context.Contextual<C>>

Type Parameters
<C>
the public type of the contextual object
Imports
java.security.PrivilegedAction, .PrivilegedActionException, .PrivilegedExceptionAction, java.util.concurrent.Callable, java.util.function.BiConsumer, .BiFunction, .BiPredicate, .Consumer, .Function, .IntFunction, .LongFunction, .Predicate, org.wildfly.common.Assert, org.wildfly.common._private.CommonMessages, org.wildfly.common.annotation.NotNull, org.wildfly.common.function.ExceptionBiConsumer, .ExceptionBiFunction, .ExceptionBiPredicate, .ExceptionConsumer, .ExceptionFunction, .ExceptionIntFunction, .ExceptionLongFunction, .ExceptionPredicate

A base class for contexts which are activated in a thread-local context.
Author
David M. Lloyd

Method Summary

Modifier and TypeMethod and Description
public ContextManager<C>

Returns:

the context manager (must not be null)
getInstanceContextManager
()

Get the context manager for this object.

public default void
run(Runnable
the task to run (must not be null)
runnable
)

Run the given task with this contextual object selected.

public default <
the return value type
R
>
R

Returns:

the action return value
runAction
(PrivilegedAction<R>
the task to run (must not be null)
action
)

Run the given task with this contextual object selected.

public default <
the first parameter type
T
,
the second parameter type
U
>
void
runBiConsumer(BiConsumer<T, U>
the task to run (must not be null)
consumer
,
T
the first parameter to pass to the task
param1
,
U
the second parameter to pass to the task
param2
)

Run the given task with this contextual object selected.

public default <
the first parameter type
T
,
the second parameter type
U
,
the return value type
R
>
R

Returns:

the action return value
runBiFunction
(BiFunction<T, U, R>
the task to run (must not be null)
function
,
T
the first parameter to pass to the task
param1
,
U
the second parameter to pass to the task
param2
)

Run the given task with this contextual object selected.

public default <
the first parameter type
T
,
the second parameter type
U
>
boolean

Returns:

the action return value
runBiPredicate
(BiPredicate<T, U>
the task to run (must not be null)
predicate
,
T
the first parameter to pass to the task
param1
,
U
the second parameter to pass to the task
param2
)

Run the given task with this contextual object selected.

public default <
the return value type
V
>
V

Returns:

the action return value
runCallable
(Callable<V>
the task to run (must not be null)
callable
)

Run the given task with this contextual object selected.

public default <
the parameter type
T
>
void
runConsumer(Consumer<T>
the task to run (must not be null)
consumer
,
T
the parameter to pass to the task
param
)

Run the given task with this contextual object selected.

public default <
the first parameter type
T
,
the second parameter type
U
,
the exception type
E extends Exception
>
void
runExBiConsumer(ExceptionBiConsumer<T, U, E>
the task to run (must not be null)
consumer
,
T
the first parameter to pass to the task
param1
,
U
the second parameter to pass to the task
param2
)

Run the given task with this contextual object selected.

public default <
the first parameter type
T
,
the second parameter type
U
,
the return value type
R
,
the exception type
E extends Exception
>
R

Returns:

the action return value
runExBiFunction
(ExceptionBiFunction<T, U, R, E>
the task to run (must not be null)
function
,
T
the first parameter to pass to the task
param1
,
U
the second parameter to pass to the task
param2
)

Run the given task with this contextual object selected.

public default <
the first parameter type
T
,
the second parameter type
U
,
the exception type
E extends Exception
>
boolean

Returns:

the action return value
runExBiPredicate
(ExceptionBiPredicate<T, U, E>
the task to run (must not be null)
predicate
,
T
the first parameter to pass to the task
param1
,
U
the second parameter to pass to the task
param2
)

Run the given task with this contextual object selected.

public default <
the return value type
R
>
R

Returns:

the action return value
runExceptionAction
(PrivilegedExceptionAction<R>
the task to run (must not be null)
action
)

Run the given task with this contextual object selected.

public default <
the parameter type
T
,
the exception type
E extends Exception
>
void
runExConsumer(ExceptionConsumer<T, E>
the task to run (must not be null)
consumer
,
T
the parameter to pass to the task
param
)

Run the given task with this contextual object selected.

public default <
the parameter type
T
,
the return value type
R
,
the exception type
E extends Exception
>
R

Returns:

the action return value
runExFunction
(ExceptionFunction<T, R, E>
the task to run (must not be null)
function
,
T
the parameter to pass to the task
param
)

Run the given task with this contextual object selected.

public default <
the return value type
T
,
the exception type
E extends Exception
>
T

Returns:

the action return value
runExIntFunction
(ExceptionIntFunction<T, E>
the task to run (must not be null)
function
,
int
the parameter to pass to the task
value
)

Run the given task with this contextual object selected.

public default <
the return value type
T
,
the exception type
E extends Exception
>
T

Returns:

the action return value
runExLongFunction
(ExceptionLongFunction<T, E>
the task to run (must not be null)
function
,
long
the parameter to pass to the task
value
)

Run the given task with this contextual object selected.

public default <
the first parameter type
T
,
the exception type
E extends Exception
>
boolean

Returns:

the action return value
runExPredicate
(ExceptionPredicate<T, E>
the task to run (must not be null)
predicate
,
T
the parameter to pass to the task
param
)

Run the given task with this contextual object selected.

public default <
the parameter type
T
,
the return value type
R
>
R

Returns:

the action return value
runFunction
(Function<T, R>
the task to run (must not be null)
function
,
T
the parameter to pass to the task
param
)

Run the given task with this contextual object selected.

public default <
the return value type
T
>
T

Returns:

the action return value
runIntFunction
(IntFunction<T>
the task to run (must not be null)
function
,
int
the parameter to pass to the task
value
)

Run the given task with this contextual object selected.

public default <
the return value type
T
>
T

Returns:

the action return value
runLongFunction
(LongFunction<T>
the task to run (must not be null)
function
,
long
the parameter to pass to the task
value
)

Run the given task with this contextual object selected.

public default <
the first parameter type
T
>
boolean

Returns:

the action return value
runPredicate
(Predicate<T>
the task to run (must not be null)
predicate
,
T
the parameter to pass to the task
param
)

Run the given task with this contextual object selected.

Method Detail

getInstanceContextManagerback to summary
public ContextManager<C> getInstanceContextManager()

Get the context manager for this object. The implementation of this method normally should return a constant instance.

Returns:ContextManager<C>

the context manager (must not be null)

Annotations
@NotNull
runback to summary
public default void run(Runnable runnable)

Run the given task with this contextual object selected.

Parameters
runnable:Runnable

the task to run (must not be null)

runActionback to summary
public default <R> R runAction(PrivilegedAction<R> action)

Run the given task with this contextual object selected.

Parameters
<R>
the return value type
action:PrivilegedAction<R>

the task to run (must not be null)

Returns:R

the action return value

runBiConsumerback to summary
public default <T, U> void runBiConsumer(BiConsumer<T, U> consumer, T param1, U param2)

Run the given task with this contextual object selected.

Parameters
<T>
the first parameter type
<U>
the second parameter type
consumer:BiConsumer<T, U>

the task to run (must not be null)

param1:T

the first parameter to pass to the task

param2:U

the second parameter to pass to the task

runBiFunctionback to summary
public default <T, U, R> R runBiFunction(BiFunction<T, U, R> function, T param1, U param2)

Run the given task with this contextual object selected.

Parameters
<T>
the first parameter type
<U>
the second parameter type
<R>
the return value type
function:BiFunction<T, U, R>

the task to run (must not be null)

param1:T

the first parameter to pass to the task

param2:U

the second parameter to pass to the task

Returns:R

the action return value

runBiPredicateback to summary
public default <T, U> boolean runBiPredicate(BiPredicate<T, U> predicate, T param1, U param2)

Run the given task with this contextual object selected.

Parameters
<T>
the first parameter type
<U>
the second parameter type
predicate:BiPredicate<T, U>

the task to run (must not be null)

param1:T

the first parameter to pass to the task

param2:U

the second parameter to pass to the task

Returns:boolean

the action return value

runCallableback to summary
public default <V> V runCallable(Callable<V> callable) throws Exception

Run the given task with this contextual object selected.

Parameters
<V>
the return value type
callable:Callable<V>

the task to run (must not be null)

Returns:V

the action return value

runConsumerback to summary
public default <T> void runConsumer(Consumer<T> consumer, T param)

Run the given task with this contextual object selected.

Parameters
<T>
the parameter type
consumer:Consumer<T>

the task to run (must not be null)

param:T

the parameter to pass to the task

runExBiConsumerback to summary
public default <T, U, E extends Exception> void runExBiConsumer(ExceptionBiConsumer<T, U, E> consumer, T param1, U param2) throws ExceptionBiConsumer:E

Run the given task with this contextual object selected.

Parameters
<T>
the first parameter type
<U>
the second parameter type
<E>
the exception type
consumer:ExceptionBiConsumer<T, U, E>

the task to run (must not be null)

param1:T

the first parameter to pass to the task

param2:U

the second parameter to pass to the task

Exceptions
ExceptionBiConsumer:E:
if an exception occurs in the task
runExBiFunctionback to summary
public default <T, U, R, E extends Exception> R runExBiFunction(ExceptionBiFunction<T, U, R, E> function, T param1, U param2) throws ExceptionBiConsumer:E

Run the given task with this contextual object selected.

Parameters
<T>
the first parameter type
<U>
the second parameter type
<R>
the return value type
<E>
the exception type
function:ExceptionBiFunction<T, U, R, E>

the task to run (must not be null)

param1:T

the first parameter to pass to the task

param2:U

the second parameter to pass to the task

Returns:R

the action return value

Exceptions
ExceptionBiConsumer:E:
if an exception occurs in the task
runExBiPredicateback to summary
public default <T, U, E extends Exception> boolean runExBiPredicate(ExceptionBiPredicate<T, U, E> predicate, T param1, U param2) throws ExceptionBiConsumer:E

Run the given task with this contextual object selected.

Parameters
<T>
the first parameter type
<U>
the second parameter type
<E>
the exception type
predicate:ExceptionBiPredicate<T, U, E>

the task to run (must not be null)

param1:T

the first parameter to pass to the task

param2:U

the second parameter to pass to the task

Returns:boolean

the action return value

Exceptions
ExceptionBiConsumer:E:
if an exception occurs in the task
runExceptionActionback to summary
public default <R> R runExceptionAction(PrivilegedExceptionAction<R> action) throws PrivilegedActionException

Run the given task with this contextual object selected.

Parameters
<R>
the return value type
action:PrivilegedExceptionAction<R>

the task to run (must not be null)

Returns:R

the action return value

Exceptions
PrivilegedActionException:
if the action fails with an exception
runExConsumerback to summary
public default <T, E extends Exception> void runExConsumer(ExceptionConsumer<T, E> consumer, T param) throws ExceptionBiConsumer:E

Run the given task with this contextual object selected.

Parameters
<T>
the parameter type
<E>
the exception type
consumer:ExceptionConsumer<T, E>

the task to run (must not be null)

param:T

the parameter to pass to the task

Exceptions
ExceptionBiConsumer:E:
if an exception occurs in the task
runExFunctionback to summary
public default <T, R, E extends Exception> R runExFunction(ExceptionFunction<T, R, E> function, T param) throws ExceptionBiConsumer:E

Run the given task with this contextual object selected.

Parameters
<T>
the parameter type
<R>
the return value type
<E>
the exception type
function:ExceptionFunction<T, R, E>

the task to run (must not be null)

param:T

the parameter to pass to the task

Returns:R

the action return value

Exceptions
ExceptionBiConsumer:E:
if an exception occurs in the task
runExIntFunctionback to summary
public default <T, E extends Exception> T runExIntFunction(ExceptionIntFunction<T, E> function, int value) throws ExceptionBiConsumer:E

Run the given task with this contextual object selected.

Parameters
<T>
the return value type
<E>
the exception type
function:ExceptionIntFunction<T, E>

the task to run (must not be null)

value:int

the parameter to pass to the task

Returns:T

the action return value

Exceptions
ExceptionBiConsumer:E:
if an exception occurs in the task
runExLongFunctionback to summary
public default <T, E extends Exception> T runExLongFunction(ExceptionLongFunction<T, E> function, long value) throws ExceptionBiConsumer:E

Run the given task with this contextual object selected.

Parameters
<T>
the return value type
<E>
the exception type
function:ExceptionLongFunction<T, E>

the task to run (must not be null)

value:long

the parameter to pass to the task

Returns:T

the action return value

Exceptions
ExceptionBiConsumer:E:
if an exception occurs in the task
runExPredicateback to summary
public default <T, E extends Exception> boolean runExPredicate(ExceptionPredicate<T, E> predicate, T param) throws ExceptionBiConsumer:E

Run the given task with this contextual object selected.

Parameters
<T>
the first parameter type
<E>
the exception type
predicate:ExceptionPredicate<T, E>

the task to run (must not be null)

param:T

the parameter to pass to the task

Returns:boolean

the action return value

Exceptions
ExceptionBiConsumer:E:
if an exception occurs in the task
runFunctionback to summary
public default <T, R> R runFunction(Function<T, R> function, T param)

Run the given task with this contextual object selected.

Parameters
<T>
the parameter type
<R>
the return value type
function:Function<T, R>

the task to run (must not be null)

param:T

the parameter to pass to the task

Returns:R

the action return value

runIntFunctionback to summary
public default <T> T runIntFunction(IntFunction<T> function, int value)

Run the given task with this contextual object selected.

Parameters
<T>
the return value type
function:IntFunction<T>

the task to run (must not be null)

value:int

the parameter to pass to the task

Returns:T

the action return value

runLongFunctionback to summary
public default <T> T runLongFunction(LongFunction<T> function, long value)

Run the given task with this contextual object selected.

Parameters
<T>
the return value type
function:LongFunction<T>

the task to run (must not be null)

value:long

the parameter to pass to the task

Returns:T

the action return value

runPredicateback to summary
public default <T> boolean runPredicate(Predicate<T> predicate, T param)

Run the given task with this contextual object selected.

Parameters
<T>
the first parameter type
predicate:Predicate<T>

the task to run (must not be null)

param:T

the parameter to pass to the task

Returns:boolean

the action return value