public class PredicateFilter extends Object implements MetadataFilter
EntityDescriptor
that does or does not match a Predicate
, thus
a whitelist or blacklist.
If an EntitiesDescriptor
does not contain any children after filtering it may, optionally, be removed as
well. If the root element of the metadata document is an @link EntitiesDescriptor}, it will never be removed,
regardless of of whether it still has children.
Modifier and Type | Class and Description |
---|---|
static class |
PredicateFilter.Direction
Whether matching means to include or exclude an entity.
|
Modifier and Type | Field and Description |
---|---|
private com.google.common.base.Predicate<EntityDescriptor> |
condition
Matching predicate.
|
private PredicateFilter.Direction |
direction
Whether matching means to include or exclude an entity.
|
private org.slf4j.Logger |
log
Class logger.
|
private boolean |
removeEmptyEntitiesDescriptors
Whether to keep entities descriptors that contain no entity descriptors; default value: true.
|
Constructor and Description |
---|
PredicateFilter(PredicateFilter.Direction dir,
com.google.common.base.Predicate<EntityDescriptor> theCondition)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
org.opensaml.core.xml.XMLObject |
filter(org.opensaml.core.xml.XMLObject metadata) |
protected void |
filterEntitiesDescriptor(EntitiesDescriptor descriptor)
Filters entities descriptor.
|
com.google.common.base.Predicate<EntityDescriptor> |
getCondition()
Get the predicate to be applied.
|
PredicateFilter.Direction |
getDirection()
Get the direction of filtering.
|
boolean |
getRemoveEmptyEntitiesDescriptors()
Get whether to remove an entities descriptor if it does not contain any entity descriptor or entities
descriptors.
|
void |
setRemoveEmptyEntitiesDescriptors(boolean remove)
Set whether to remove an entities descriptor if it does not contain any entity descriptor or entities
descriptors.
|
@Nonnull private final org.slf4j.Logger log
@Nonnull private final PredicateFilter.Direction direction
@Nonnull private final com.google.common.base.Predicate<EntityDescriptor> condition
private boolean removeEmptyEntitiesDescriptors
public PredicateFilter(@Nonnull PredicateFilter.Direction dir, @Nonnull com.google.common.base.Predicate<EntityDescriptor> theCondition)
dir
- whether to whitelist or blacklisttheCondition
- the predicate to apply to determine inclusion or exclusion@Nonnull public PredicateFilter.Direction getDirection()
@Nonnull public com.google.common.base.Predicate<EntityDescriptor> getCondition()
public boolean getRemoveEmptyEntitiesDescriptors()
public void setRemoveEmptyEntitiesDescriptors(boolean remove)
remove
- whether to remove an entities descriptor if it does not contain any entity descriptor or entities
descriptorspublic org.opensaml.core.xml.XMLObject filter(@Nullable org.opensaml.core.xml.XMLObject metadata) throws FilterException
filter
in interface MetadataFilter
FilterException
protected void filterEntitiesDescriptor(@Nonnull EntitiesDescriptor descriptor)
descriptor
- entities descriptor to filterCopyright © 1999–2020 Shibboleth Consortium. All rights reserved.