T - the target type which the returned predicates evaluatepublic class CriterionPredicateRegistry<T> extends Object
Criterion to types of Predicate
which can evaluate that criterion's data against a particular target type.
Each predicate's implementation that is registered MUST implement a
single-arg constructor which takes an instance of the Criterion to be evaluated.
The predicate instance is instantiated reflectively based on this requirement.
| Modifier and Type | Field and Description |
|---|---|
private Logger |
log
Logger.
|
private Map<Class<? extends Criterion>,Class<? extends com.google.common.base.Predicate<T>>> |
registry
Storage for the registry mappings.
|
| Constructor and Description |
|---|
CriterionPredicateRegistry()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearRegistry()
Clear all mappings from the registry.
|
void |
deregister(Class<? extends Criterion> criterionClass)
Deregister a criterion-evaluator mapping.
|
com.google.common.base.Predicate<T> |
getPredicate(Criterion criterion)
Get an instance of
Predicate which can evaluate the supplied criterion's
requirements against a target of the specified type. |
void |
loadMappings(Properties mappings)
Load a set of criterion -> predicate mappings from the supplied properties set.
|
void |
loadMappings(String classpathResource)
Load criterion -> predicate mappings from a classpath resource.
|
protected Class<? extends com.google.common.base.Predicate<T>> |
lookup(Class<? extends Criterion> clazz)
Lookup the predicate class type which is registered for the specified Criterion class.
|
void |
register(Class<? extends Criterion> criterionClass,
Class<? extends com.google.common.base.Predicate<T>> predicateClass)
Register a
Predicate class for a criterion class. |
private Logger log
@Nullable public com.google.common.base.Predicate<T> getPredicate(@Nonnull Criterion criterion) throws ResolverException
Predicate which can evaluate the supplied criterion's
requirements against a target of the specified type.criterion - the criterion to be evaluatedResolverException - thrown if there is an error reflectively instantiating a new instance of
the predicate type based on class information stored in the registry@Nullable protected Class<? extends com.google.common.base.Predicate<T>> lookup(@Nonnull Class<? extends Criterion> clazz)
clazz - the Criterion class subtype to lookuppublic void register(@Nonnull Class<? extends Criterion> criterionClass, @Nonnull Class<? extends com.google.common.base.Predicate<T>> predicateClass)
Predicate class for a criterion class.criterionClass - class subtype of CriterionpredicateClass - the predicate class typepublic void deregister(@Nonnull Class<? extends Criterion> criterionClass)
criterionClass - class subtype of Criterionpublic void clearRegistry()
public void loadMappings(@Nonnull String classpathResource)
classpathResource - the classpath resource path from which to load mapping properitespublic void loadMappings(@Nonnull Properties mappings)
mappings - properties set where the key is the criterion class name, the value is the predicate class nameCopyright © 1999–2020 Shibboleth Consortium. All rights reserved.