Class MessageContextPredicateAdapter

All Implemented Interfaces:
Predicate<MessageContext>, 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 Details


      @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)

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

      prcPredicate - the adapted predicate
    • MessageContextPredicateAdapter

      public MessageContextPredicateAdapter(@Nonnull @ParameterName(name="prcPredicate") Predicate<ProfileRequestContext> prcPredicate, @ParameterName(name="unresolvedSatisfies") boolean unresolvedSatisfies)
      prcPredicate - the adapted predicate
      unresolvedSatisfies - whether failure to resolve a parent ProfileRequestContext satisfies the predicate
  • Method Details