Package net.shibboleth.shared.resolver
Class CriterionPredicateRegistry<T>
java.lang.Object
net.shibboleth.shared.resolver.CriterionPredicateRegistry<T>
- Type Parameters:
T- the target type which the returned predicates evaluate
A registry which manages mappings from types of
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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClear all mappings from the registry.voidderegister(Class<? extends Criterion> criterionClass) Deregister a criterion-evaluator mapping.getPredicate(Criterion criterion) Get an instance ofPredicatewhich can evaluate the supplied criterion's requirements against a target of the specified type.voidloadMappings(String classpathResource) Load criterion -> predicate mappings from a classpath resource.voidloadMappings(Properties mappings) Load a set of criterion -> predicate mappings from the supplied properties set.Lookup the predicate class type which is registered for the specified Criterion class.voidRegister aPredicateclass for a criterion class.
-
Field Details
-
log
@Nonnull private org.slf4j.Logger logLogger. -
registry
Storage for the registry mappings.
-
-
Constructor Details
-
CriterionPredicateRegistry
public CriterionPredicateRegistry()Constructor.
-
-
Method Details
-
lookup
Lookup the predicate class type which is registered for the specified Criterion class.- Parameters:
clazz- the Criterion class subtype to lookup- Returns:
- the registered predicate class type
-
register
public void register(@Nonnull Class<? extends Criterion> criterionClass, @Nonnull Class<? extends Predicate<T>> predicateClass) Register aPredicateclass for a criterion class.- Parameters:
criterionClass- class subtype ofCriterionpredicateClass- the predicate class type
-
deregister
Deregister a criterion-evaluator mapping.- Parameters:
criterionClass- class subtype ofCriterion
-
clearRegistry
public void clearRegistry()Clear all mappings from the registry. -
loadMappings
Load criterion -> predicate mappings from a classpath resource.- Parameters:
classpathResource- the classpath resource path from which to load mapping properites
-
loadMappings
Load a set of criterion -> predicate mappings from the supplied properties set.- Parameters:
mappings- properties set where the key is the criterion class name, the value is the predicate class name