Package org.opensaml.profile.logic

# Class MessageContextPredicateAdapter

java.lang.Object
org.opensaml.profile.logic.MessageContextPredicateAdapter

All Implemented Interfaces:
  `Predicate<MessageContext>`

public class MessageContextPredicateAdapter extends Object implements Predicate<MessageContext>
A `Predicate` which adapts an existing `ProfileRequestContext` predicate for use as a `MessageContext` predicate.

In normal usage the message context evaluated must have a `ProfileRequestContext` somewhere in its parent chain. Typically this will be its direct parent context, as supplied by `BaseContext.getParent()`. An optional flag is supplied to determine the evaluation result when no parent profile request context can be located. This case defaults to `false`.

One example is for use as a `MessageHandler` activation condition via `AbstractMessageHandler.setActivationCondition(Predicate)`.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Predicate<ProfileRequestContext>`
`adapted`
The adapted predicate.
`private boolean`
`noPRCSatisfies`
Flag indicating whether failure to resolve a parent ProfileRequestContext satisfies the predicate.
`private static final ParentProfileRequestContextLookup<MessageContext>`
`PRC_LOOKUP`
The lookup function for the ProfileRequestContext.

## Constructor Summary

Constructors
Constructor
Description
`MessageContextPredicateAdapter(Predicate<ProfileRequestContext> prcPredicate)`
Constructor.
`MessageContextPredicateAdapter(Predicate<ProfileRequestContext> prcPredicate, boolean unresolvedSatisfies)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`test(MessageContext input)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.util.function.Predicate

`and, negate, or`

## Field Details

### PRC_LOOKUP

@Nonnull private static final ParentProfileRequestContextLookup<MessageContext> PRC_LOOKUP
The lookup function for the ProfileRequestContext.

### adapted

@Nonnull private Predicate<ProfileRequestContext> adapted
The adapted predicate.

### noPRCSatisfies

private boolean noPRCSatisfies
Flag indicating whether failure to resolve a parent ProfileRequestContext satisfies the predicate.

## Constructor Details

### MessageContextPredicateAdapter

public MessageContextPredicateAdapter(@Nonnull @ParameterName(name="prcPredicate") Predicate<ProfileRequestContext> prcPredicate)
Constructor.

Failure to resolve the `ProfileRequestContext` parent results in an evaluation of `false`.

Parameters:
  `prcPredicate` - the adapted predicate

### MessageContextPredicateAdapter

public MessageContextPredicateAdapter(@Nonnull @ParameterName(name="prcPredicate") Predicate<ProfileRequestContext> prcPredicate, @ParameterName(name="unresolvedSatisfies") boolean unresolvedSatisfies)
Constructor.

Parameters:
  `prcPredicate` - the adapted predicate
  `unresolvedSatisfies` - whether failure to resolve a parent ProfileRequestContext satisfies the predicate

## Method Details

### test

public boolean test(@Nullable MessageContext input)

Specified by:
  `test` in interface `Predicate<MessageContext>`