Package net.shibboleth.idp.attribute.filter.testing

# Class MockMatcher

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.idp.attribute.filter.testing.MockMatcher

All Implemented Interfaces:
  `Matcher`, `Component`, `DestructableComponent`, `IdentifiedComponent`, `InitializableComponent`

public class MockMatcher extends AbstractIdentifiedInitializableComponent implements Matcher
A simple, mock implementation of `Matcher`.

## Field Summary

Fields
Modifier and Type
Field
Description
`private boolean`
`fails`
do we fail when validate is called? do we fail when we are called?
`private boolean`
`initialized`
state variable
`private String`
`matchingAttribute`
ID of the attribute to which this matcher applies.
`private Collection<?>`
`matchingValues`
Values, of the attribute, considered to match this matcher.

### Fields inherited from interface net.shibboleth.idp.attribute.filter.Matcher

`MATCHER_FAILS, MATCHES_ALL, MATCHES_NONE`

## Constructor Summary

Constructors
Constructor
Description
`MockMatcher()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`doInitialize()`
`Set<IdPAttributeValue>`
`getMatchingValues(IdPAttribute attribute, AttributeFilterContext filterContext)`
Return those `IdPAttributeValue`s which match this rule, or null if the matcher failed.
`boolean`
`isInitialized()`
`void`
`setFailValidate(boolean doFail)`
set whether we are going to fail {`getMatchingValues(IdPAttribute, AttributeFilterContext)`.
`void`
`setMatchingAttribute(String id)`
Sets the ID of the attribute to which this matcher applies.
`void`
`setMatchingValues(Collection<?> values)`
Sets the values, of the attribute, considered to match this matcher.

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

`ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, setId`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed`

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

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

### Methods inherited from interface net.shibboleth.shared.component.IdentifiedComponent

`getId`

## Field Details

### matchingAttribute

@Nullable private String matchingAttribute
ID of the attribute to which this matcher applies.

### matchingValues

@Nullable private Collection<?> matchingValues
Values, of the attribute, considered to match this matcher.

### initialized

private boolean initialized
state variable

### fails

private boolean fails
do we fail when validate is called? do we fail when we are called?

## Constructor Details

### MockMatcher

public MockMatcher()
Constructor.

## Method Details

### setMatchingAttribute

public void setMatchingAttribute(@Nonnull String id)
Sets the ID of the attribute to which this matcher applies.

Parameters:
  `id` - ID of the attribute to which this matcher applies

### setMatchingValues

public void setMatchingValues(@Nullable Collection<?> values)
Sets the values, of the attribute, considered to match this matcher. If null then all attribute values are considered to be matching.

Parameters:
  `values` - values, of the attribute, considered to match this matcher

### getMatchingValues

@Nullable public Set<IdPAttributeValue> getMatchingValues(@Nonnull IdPAttribute attribute, @Nonnull AttributeFilterContext filterContext)
Return those `IdPAttributeValue`s which match this rule, or null if the matcher failed.

Specified by:
  `getMatchingValues` in interface `Matcher`
Parameters:
  `attribute` - the attribute under question.
  `filterContext` - the filter context
Returns:
  The result of this rule. Null if we failed.

### isInitialized

public boolean isInitialized()

Specified by:
  `isInitialized` in interface `InitializableComponent`
Overrides:
  `isInitialized` in class `AbstractInitializableComponent`

### doInitialize

public void doInitialize()

Overrides:
  `doInitialize` in class `AbstractIdentifiedInitializableComponent`

### setFailValidate

public void setFailValidate(boolean doFail)
set whether we are going to fail {`getMatchingValues(IdPAttribute, AttributeFilterContext)`.

Parameters:
  `doFail` - whether we are going to fail.