Class Predicates
- java.lang.Object
-
- com.oracle.coherence.concurrent.executor.function.Predicates
-
public final class Predicates extends Object
Helper methods forRemote.Predicate
s.- Since:
- 21.12
- Author:
- bo
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Predicates.AlwaysPredicate
AnPredicates.AlwaysPredicate
returns true for any value provided to thePredicate.test(Object)
method.static class
Predicates.EqualToPredicate<T>
ARemote.Predicate
to compare a value usingObject.equals(Object)
.static class
Predicates.IsValuePredicate<T>
AnPredicates.IsValuePredicate
returns true when a providedResult.isValue()
.static class
Predicates.NegatePredicate<T>
ARemote.Predicate
that negates the result of anotherRemote.Predicate
.static class
Predicates.NeverPredicate
AnPredicates.NeverPredicate
returns false for any value provided to thePredicate.test(Object)
method.static class
Predicates.NullValuePredicate
AnPredicates.NullValuePredicate
returnstrue
for any value provided to thePredicate.test(Object)
method that isnull
.static class
Predicates.OptionPredicate
ARemote.Predicate
to determine if anTaskExecutorService.ExecutorInfo
has a specificTaskExecutorService.Registration.Option
.static class
Predicates.RolePredicate
ARemote.Predicate
for matching the name of aRole
.static class
Predicates.ThrowablePredicate<T>
AnPredicates.ThrowablePredicate
returns true when a providedResult.isThrowable()
.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Remote.Predicate<T>
always()
Obtains aRemote.Predicate
that always succeeds.static <T> Remote.Predicate<T>
anything()
Obtains aRemote.Predicate
that always succeeds.static <T> Remote.Predicate<Result<T>>
available()
Obtains aRemote.Predicate
that succeeds whenResult.isPresent()
()}.static <T> Remote.Predicate<T>
equalTo(T value)
Obtains aRemote.Predicate
that usesObject.equals(Object)
to compare against a specified value.static Remote.Predicate<com.oracle.coherence.concurrent.executor.TaskExecutorService.ExecutorInfo>
has(com.oracle.coherence.concurrent.executor.TaskExecutorService.Registration.Option option)
Obtains aRemote.Predicate
forTaskExecutorService.ExecutorInfo
to determine if a specificTaskExecutorService.Registration.Option
is defined.static <T> Remote.Predicate<T>
is(Remote.Predicate<T> predicate)
Returns the specifiedRemote.Predicate
.static <T> Remote.Predicate<T>
is(T value)
Obtains aRemote.Predicate
that usesObject.equals(Object)
to compare against a specified value.static <T> Remote.Predicate<T>
never()
Obtains aRemote.Predicate
that never succeeds.static <T> Remote.Predicate<T>
not(Remote.Predicate<T> predicate)
Obtains aRemote.Predicate
that negates the result of anotherRemote.Predicate
.static <T> Remote.Predicate<T>
notNullValue()
Obtains aRemote.Predicate
that succeeds when provided with a non-null
value.static <T> Remote.Predicate<T>
nullValue()
Obtains aRemote.Predicate
that succeeds when provided with anull
value.static <T> Remote.Predicate<Result<T>>
onException()
Obtains aRemote.Predicate
to ensure that theThrowable
is handled.static <T> Remote.Predicate<Result<T>>
onException(Throwable throwable)
static Remote.Predicate<com.oracle.coherence.concurrent.executor.TaskExecutorService.ExecutorInfo>
role(String pattern)
-
-
-
Method Detail
-
always
public static <T> Remote.Predicate<T> always()
Obtains aRemote.Predicate
that always succeeds.- Type Parameters:
T
- the type of value- Returns:
- a
Remote.Predicate
-
anything
public static <T> Remote.Predicate<T> anything()
Obtains aRemote.Predicate
that always succeeds.- Type Parameters:
T
- the type of value- Returns:
- a
Remote.Predicate
-
never
public static <T> Remote.Predicate<T> never()
Obtains aRemote.Predicate
that never succeeds.- Type Parameters:
T
- the type of value- Returns:
- a
Remote.Predicate
-
nullValue
public static <T> Remote.Predicate<T> nullValue()
Obtains aRemote.Predicate
that succeeds when provided with anull
value.- Type Parameters:
T
- the type of value- Returns:
- a
Remote.Predicate
-
notNullValue
public static <T> Remote.Predicate<T> notNullValue()
Obtains aRemote.Predicate
that succeeds when provided with a non-null
value.- Type Parameters:
T
- the type of value- Returns:
- a
Remote.Predicate
-
equalTo
public static <T> Remote.Predicate<T> equalTo(T value)
Obtains aRemote.Predicate
that usesObject.equals(Object)
to compare against a specified value.- Type Parameters:
T
- the type of value- Parameters:
value
- the value to compare- Returns:
- a
Remote.Predicate
-
is
public static <T> Remote.Predicate<T> is(T value)
Obtains aRemote.Predicate
that usesObject.equals(Object)
to compare against a specified value.- Type Parameters:
T
- the type of value- Parameters:
value
- the value to compare- Returns:
- a
Remote.Predicate
- See Also:
equalTo(Object)
-
is
public static <T> Remote.Predicate<T> is(Remote.Predicate<T> predicate)
Returns the specifiedRemote.Predicate
.This is syntactic sugar to allow more expressive predicate construction.
- Type Parameters:
T
- the type of value for theRemote.Predicate
- Parameters:
predicate
- theRemote.Predicate
to return- Returns:
- the specified
Remote.Predicate
-
not
public static <T> Remote.Predicate<T> not(Remote.Predicate<T> predicate)
Obtains aRemote.Predicate
that negates the result of anotherRemote.Predicate
.- Type Parameters:
T
- the type of the value- Parameters:
predicate
- theRemote.Predicate
to negate- Returns:
- a
Remote.Predicate
-
available
public static <T> Remote.Predicate<Result<T>> available()
Obtains aRemote.Predicate
that succeeds whenResult.isPresent()
()}.- Type Parameters:
T
- the type ofTask
result- Returns:
- a
Remote.Predicate
-
role
public static Remote.Predicate<com.oracle.coherence.concurrent.executor.TaskExecutorService.ExecutorInfo> role(String pattern)
- Parameters:
pattern
- theRole
name pattern to match- Returns:
- a
Remote.Predicate
forTaskExecutorService.ExecutorInfo
-
has
public static Remote.Predicate<com.oracle.coherence.concurrent.executor.TaskExecutorService.ExecutorInfo> has(com.oracle.coherence.concurrent.executor.TaskExecutorService.Registration.Option option)
Obtains aRemote.Predicate
forTaskExecutorService.ExecutorInfo
to determine if a specificTaskExecutorService.Registration.Option
is defined.- Parameters:
option
- theTaskExecutorService.Registration.Option
- Returns:
- a
Remote.Predicate
forTaskExecutorService.ExecutorInfo
-
onException
public static <T> Remote.Predicate<Result<T>> onException()
Obtains aRemote.Predicate
to ensure that theThrowable
is handled.- Type Parameters:
T
- the type of the task- Returns:
- a
Remote.Predicate
forThrowable
-
onException
public static <T> Remote.Predicate<Result<T>> onException(Throwable throwable)
- Type Parameters:
T
- the type of the task- Parameters:
throwable
- a result with a throwable- Returns:
- a
Remote.Predicate
for a givenThrowable
-
-