Package net.shibboleth.profile.context.logic

# Class DynamicAttributePredicate

java.lang.Object
net.shibboleth.profile.context.logic.AbstractAttributePredicate
net.shibboleth.profile.context.logic.DynamicAttributePredicate

All Implemented Interfaces:
  `Predicate<ProfileRequestContext>`

public class DynamicAttributePredicate extends AbstractAttributePredicate
Predicate over an `AttributeContext` that derives the value(s) to match based on one or more supplied Functions instead of static values.

Each function installed must return a value that matches a value of the attribute corresponding to the map key.

Functions may return a `String` or a `Collection` containing them.

Since:
  3.4.0

## Field Summary

Fields
Modifier and Type
Field
Description
`private ListMultimap<String,Function<ProfileRequestContext,Object>>`
`attributeFunctionMap`
Map of attribute IDs to functions.
`private final org.slf4j.Logger`
`log`
Class logger.

## Constructor Summary

Constructors
Constructor
Description
`DynamicAttributePredicate()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected boolean`
`findMatch(String toMatch, IdPAttribute attribute)`
Look for a matching value in an attribute.
`protected boolean`
`hasMatch(Map<String,IdPAttribute> attributeMap)`
Abstract implementation of the condition to evaluate.
`protected boolean`
`hasMatch(ProfileRequestContext profileRequestContext, Map<String,IdPAttribute> attributeMap)`
Implementation of the condition to evaluate.
`void`
`setAttributeFunctionMap(Map<String,Collection<Function<ProfileRequestContext,Object>>> map)`
Set the map of attribute/function pairs (as a map of function collections) to check for.
`boolean`
`test(ProfileRequestContext input)`

### Methods inherited from class net.shibboleth.profile.context.logic.AbstractAttributePredicate

`allowNullAttributeContext, getAttributeContextLookupStrategy, isUseUnfilteredAttributes, setAttributeContextLookupStrategy, setUseUnfilteredAttributes`

### 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

### log

@Nonnull private final org.slf4j.Logger log
Class logger.

### attributeFunctionMap

@Nonnull private ListMultimap<String,Function<ProfileRequestContext,Object>> attributeFunctionMap
Map of attribute IDs to functions.

## Constructor Details

### DynamicAttributePredicate

public DynamicAttributePredicate()
Constructor.

## Method Details

### setAttributeFunctionMap

public void setAttributeFunctionMap(@Nonnull Map<String,Collection<Function<ProfileRequestContext,Object>>> map)
Set the map of attribute/function pairs (as a map of function collections) to check for.

Parameters:
  `map` - map of attribute/function pairs

### test

public boolean test(@Nullable ProfileRequestContext input)

Specified by:
  `test` in interface `Predicate<ProfileRequestContext>`
Overrides:
  `test` in class `AbstractAttributePredicate`

### hasMatch

protected boolean hasMatch(@Nonnull Map<String,IdPAttribute> attributeMap)
Abstract implementation of the condition to evaluate.

Specified by:
  `hasMatch` in class `AbstractAttributePredicate`
Parameters:
  `attributeMap` - the attributes to evaluate
Returns:
  the condition result

### hasMatch

protected boolean hasMatch(@Nullable ProfileRequestContext profileRequestContext, @Nonnull Map<String,IdPAttribute> attributeMap)
Implementation of the condition to evaluate.

Parameters:
  `profileRequestContext` - current profile request context
  `attributeMap` - the attributes to evaluate
Returns:
  the condition result

### findMatch

protected boolean findMatch(@Nonnull @NotEmpty String toMatch, @Nonnull IdPAttribute attribute)
Look for a matching value in an attribute.

Parameters:
  `toMatch` - value to look for
  `attribute` - attribute to check
Returns:
  true iff the value is one of the attribute's values