Class ConditionEvaluator
java.lang.Object
com.zetaplugins.zetacore.di.condition.ConditionEvaluator
Evaluates
Conditional, ConditionalOnPlugin and ConditionalOnMissingPlugin on classes and methods.
The result of each Condition class is cached. The evaluator is thread-safe.-
Constructor Summary
ConstructorsConstructorDescriptionConditionEvaluator(JavaPlugin plugin, ServiceRegistry registry) Creates an evaluator. -
Method Summary
Modifier and TypeMethodDescriptionfindFailedCondition(AnnotatedElement element) Finds the first condition on the element that does not match.booleanmatches(AnnotatedElement element) Checks whether all conditions on the element match.
-
Constructor Details
-
ConditionEvaluator
Creates an evaluator.- Parameters:
plugin- The plugin, used to look up other plugins.registry- The registry used to create conditions with dependency injection, or null to create them with their no-argument constructor.
-
-
Method Details
-
matches
Checks whether all conditions on the element match. Elements without conditions always match.- Parameters:
element- The class or method to check.- Returns:
- True if the element is active.
-
findFailedCondition
Finds the first condition on the element that does not match.- Parameters:
element- The class or method to check.- Returns:
- A description of the failed condition, or null if all conditions match.
-