Package org.wildfly.common.context
Interface Contextual<C extends Contextual<C>>
-
- Type Parameters:
C- the public type of the contextual object
public interface Contextual<C extends Contextual<C>>A base class for contexts which are activated in a thread-local context.- Author:
- David M. Lloyd
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ContextManager<C>getInstanceContextManager()Get the context manager for this object.default voidrun(Runnable runnable)Run the given task with this contextual object selected.default <R> RrunAction(PrivilegedAction<R> action)Run the given task with this contextual object selected.default <T,U>
voidrunBiConsumer(BiConsumer<T,U> consumer, T param1, U param2)Run the given task with this contextual object selected.default <T,U,R>
RrunBiFunction(BiFunction<T,U,R> function, T param1, U param2)Run the given task with this contextual object selected.default <T,U>
booleanrunBiPredicate(BiPredicate<T,U> predicate, T param1, U param2)Run the given task with this contextual object selected.default <V> VrunCallable(Callable<V> callable)Run the given task with this contextual object selected.default <T> voidrunConsumer(Consumer<T> consumer, T param)Run the given task with this contextual object selected.default <T,U,E extends Exception>
voidrunExBiConsumer(ExceptionBiConsumer<T,U,E> consumer, T param1, U param2)Run the given task with this contextual object selected.default <T,U,R,E extends Exception>
RrunExBiFunction(ExceptionBiFunction<T,U,R,E> function, T param1, U param2)Run the given task with this contextual object selected.default <T,U,E extends Exception>
booleanrunExBiPredicate(ExceptionBiPredicate<T,U,E> predicate, T param1, U param2)Run the given task with this contextual object selected.default <R> RrunExceptionAction(PrivilegedExceptionAction<R> action)Run the given task with this contextual object selected.default <T,E extends Exception>
voidrunExConsumer(ExceptionConsumer<T,E> consumer, T param)Run the given task with this contextual object selected.default <T,R,E extends Exception>
RrunExFunction(ExceptionFunction<T,R,E> function, T param)Run the given task with this contextual object selected.default <T,E extends Exception>
TrunExIntFunction(ExceptionIntFunction<T,E> function, int value)Run the given task with this contextual object selected.default <T,E extends Exception>
TrunExLongFunction(ExceptionLongFunction<T,E> function, long value)Run the given task with this contextual object selected.default <T,E extends Exception>
booleanrunExPredicate(ExceptionPredicate<T,E> predicate, T param)Run the given task with this contextual object selected.default <T,R>
RrunFunction(Function<T,R> function, T param)Run the given task with this contextual object selected.default <T> TrunIntFunction(IntFunction<T> function, int value)Run the given task with this contextual object selected.default <T> TrunLongFunction(LongFunction<T> function, long value)Run the given task with this contextual object selected.default <T> booleanrunPredicate(Predicate<T> predicate, T param)Run the given task with this contextual object selected.
-
-
-
Method Detail
-
getInstanceContextManager
@NotNull ContextManager<C> getInstanceContextManager()
Get the context manager for this object. The implementation of this method normally should return a constant instance.- Returns:
- the context manager (must not be
null)
-
run
default void run(Runnable runnable)
Run the given task with this contextual object selected.- Parameters:
runnable- the task to run (must not benull)
-
runAction
default <R> R runAction(PrivilegedAction<R> action)
Run the given task with this contextual object selected.- Type Parameters:
R- the return value type- Parameters:
action- the task to run (must not benull)- Returns:
- the action return value
-
runExceptionAction
default <R> R runExceptionAction(PrivilegedExceptionAction<R> action) throws PrivilegedActionException
Run the given task with this contextual object selected.- Type Parameters:
R- the return value type- Parameters:
action- the task to run (must not benull)- Returns:
- the action return value
- Throws:
PrivilegedActionException- if the action fails with an exception
-
runCallable
default <V> V runCallable(Callable<V> callable) throws Exception
Run the given task with this contextual object selected.- Type Parameters:
V- the return value type- Parameters:
callable- the task to run (must not benull)- Returns:
- the action return value
- Throws:
Exception
-
runBiConsumer
default <T,U> void runBiConsumer(BiConsumer<T,U> consumer, T param1, U param2)
Run the given task with this contextual object selected.- Type Parameters:
T- the first parameter typeU- the second parameter type- Parameters:
consumer- the task to run (must not benull)param1- the first parameter to pass to the taskparam2- the second parameter to pass to the task
-
runExBiConsumer
default <T,U,E extends Exception> void runExBiConsumer(ExceptionBiConsumer<T,U,E> consumer, T param1, U param2) throws E extends Exception
Run the given task with this contextual object selected.- Type Parameters:
T- the first parameter typeU- the second parameter typeE- the exception type- Parameters:
consumer- the task to run (must not benull)param1- the first parameter to pass to the taskparam2- the second parameter to pass to the task- Throws:
E- if an exception occurs in the taskE extends Exception
-
runConsumer
default <T> void runConsumer(Consumer<T> consumer, T param)
Run the given task with this contextual object selected.- Type Parameters:
T- the parameter type- Parameters:
consumer- the task to run (must not benull)param- the parameter to pass to the task
-
runExConsumer
default <T,E extends Exception> void runExConsumer(ExceptionConsumer<T,E> consumer, T param) throws E extends Exception
Run the given task with this contextual object selected.- Type Parameters:
T- the parameter typeE- the exception type- Parameters:
consumer- the task to run (must not benull)param- the parameter to pass to the task- Throws:
E- if an exception occurs in the taskE extends Exception
-
runBiFunction
default <T,U,R> R runBiFunction(BiFunction<T,U,R> function, T param1, U param2)
Run the given task with this contextual object selected.- Type Parameters:
T- the first parameter typeU- the second parameter typeR- the return value type- Parameters:
function- the task to run (must not benull)param1- the first parameter to pass to the taskparam2- the second parameter to pass to the task- Returns:
- the action return value
-
runExBiFunction
default <T,U,R,E extends Exception> R runExBiFunction(ExceptionBiFunction<T,U,R,E> function, T param1, U param2) throws E extends Exception
Run the given task with this contextual object selected.- Type Parameters:
T- the first parameter typeU- the second parameter typeR- the return value typeE- the exception type- Parameters:
function- the task to run (must not benull)param1- the first parameter to pass to the taskparam2- the second parameter to pass to the task- Returns:
- the action return value
- Throws:
E- if an exception occurs in the taskE extends Exception
-
runFunction
default <T,R> R runFunction(Function<T,R> function, T param)
Run the given task with this contextual object selected.- Type Parameters:
T- the parameter typeR- the return value type- Parameters:
function- the task to run (must not benull)param- the parameter to pass to the task- Returns:
- the action return value
-
runExFunction
default <T,R,E extends Exception> R runExFunction(ExceptionFunction<T,R,E> function, T param) throws E extends Exception
Run the given task with this contextual object selected.- Type Parameters:
T- the parameter typeR- the return value typeE- the exception type- Parameters:
function- the task to run (must not benull)param- the parameter to pass to the task- Returns:
- the action return value
- Throws:
E- if an exception occurs in the taskE extends Exception
-
runBiPredicate
default <T,U> boolean runBiPredicate(BiPredicate<T,U> predicate, T param1, U param2)
Run the given task with this contextual object selected.- Type Parameters:
T- the first parameter typeU- the second parameter type- Parameters:
predicate- the task to run (must not benull)param1- the first parameter to pass to the taskparam2- the second parameter to pass to the task- Returns:
- the action return value
-
runExBiPredicate
default <T,U,E extends Exception> boolean runExBiPredicate(ExceptionBiPredicate<T,U,E> predicate, T param1, U param2) throws E extends Exception
Run the given task with this contextual object selected.- Type Parameters:
T- the first parameter typeU- the second parameter typeE- the exception type- Parameters:
predicate- the task to run (must not benull)param1- the first parameter to pass to the taskparam2- the second parameter to pass to the task- Returns:
- the action return value
- Throws:
E- if an exception occurs in the taskE extends Exception
-
runPredicate
default <T> boolean runPredicate(Predicate<T> predicate, T param)
Run the given task with this contextual object selected.- Type Parameters:
T- the first parameter type- Parameters:
predicate- the task to run (must not benull)param- the parameter to pass to the task- Returns:
- the action return value
-
runExPredicate
default <T,E extends Exception> boolean runExPredicate(ExceptionPredicate<T,E> predicate, T param) throws E extends Exception
Run the given task with this contextual object selected.- Type Parameters:
T- the first parameter typeE- the exception type- Parameters:
predicate- the task to run (must not benull)param- the parameter to pass to the task- Returns:
- the action return value
- Throws:
E- if an exception occurs in the taskE extends Exception
-
runIntFunction
default <T> T runIntFunction(IntFunction<T> function, int value)
Run the given task with this contextual object selected.- Type Parameters:
T- the return value type- Parameters:
function- the task to run (must not benull)value- the parameter to pass to the task- Returns:
- the action return value
-
runExIntFunction
default <T,E extends Exception> T runExIntFunction(ExceptionIntFunction<T,E> function, int value) throws E extends Exception
Run the given task with this contextual object selected.- Type Parameters:
T- the return value typeE- the exception type- Parameters:
function- the task to run (must not benull)value- the parameter to pass to the task- Returns:
- the action return value
- Throws:
E- if an exception occurs in the taskE extends Exception
-
runLongFunction
default <T> T runLongFunction(LongFunction<T> function, long value)
Run the given task with this contextual object selected.- Type Parameters:
T- the return value type- Parameters:
function- the task to run (must not benull)value- the parameter to pass to the task- Returns:
- the action return value
-
runExLongFunction
default <T,E extends Exception> T runExLongFunction(ExceptionLongFunction<T,E> function, long value) throws E extends Exception
Run the given task with this contextual object selected.- Type Parameters:
T- the return value typeE- the exception type- Parameters:
function- the task to run (must not benull)value- the parameter to pass to the task- Returns:
- the action return value
- Throws:
E- if an exception occurs in the taskE extends Exception
-
-