Package org.opensaml.saml.metadata.resolver.filter.impl

# Class ByReferenceMetadataFilter

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.saml.metadata.resolver.filter.AbstractMetadataFilter
org.opensaml.saml.metadata.resolver.filter.impl.ByReferenceMetadataFilter

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `InitializableComponent`, `MetadataFilter`

public class ByReferenceMetadataFilter extends AbstractMetadataFilter
A `MetadataFilter` that associates other filters with specific `MetadataResolver` instances by ID.

The `MetadataFilterContext` is used to identify which resolver is actually running, to properly identify which filters to apply.

Since:
  4.0.0

## Field Summary

Fields
Modifier and Type
Field
Description
`private Map<String,MetadataFilter>`
`filterMap`
Map of resolver names to filters.
`private org.slf4j.Logger`
`log`
Class logger.

## Constructor Summary

Constructors
Constructor
Description
`ByReferenceMetadataFilter()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`XMLObject`
`filter(XMLObject metadata, MetadataFilterContext context)`
Filters the given metadata, perhaps to remove elements that are not wanted.
`void`
`setFilterMappings(Map<Object,MetadataFilter> map)`
Mapping of resolver names to filters to run.

### Methods inherited from class org.opensaml.saml.metadata.resolver.filter.AbstractMetadataFilter

`getType, setType`

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

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, doInitialize, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized`

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

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

## Field Details

### log

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

### filterMap

@Nonnull private Map<String,MetadataFilter> filterMap
Map of resolver names to filters.

## Constructor Details

### ByReferenceMetadataFilter

public ByReferenceMetadataFilter()
Constructor.

## Method Details

### setFilterMappings

public void setFilterMappings(@Nonnull Map<Object,MetadataFilter> map)
Mapping of resolver names to filters to run.

Parameters:
  `map` - filter mappings

### filter

@Nullable public XMLObject filter(@Nullable XMLObject metadata, @Nonnull MetadataFilterContext context) throws FilterException
Filters the given metadata, perhaps to remove elements that are not wanted.

Parameters:
  `metadata` - the metadata to be filtered.
  `context` - the metadata filter context
Returns:
  the filtered XMLObject, which may or may not be the same as the XMLObject instance passed in to the method. Maybe be null, for example if the top-level element was removed by the filter.
Throws:
  `FilterException` - thrown if an error occurs during the filtering process