Class ConditionProfileActivator
java.lang.Object
org.apache.maven.internal.impl.model.profile.ConditionProfileActivator
- All Implemented Interfaces:
ProfileActivator
@Named("condition")
@Singleton
public class ConditionProfileActivator
extends Object
implements ProfileActivator
This class is responsible for activating profiles based on conditions specified in the profile's activation section.
It evaluates the condition expression and determines whether the profile should be active.
-
Constructor Summary
ConstructorDescriptionConditionProfileActivator
(VersionParser versionParser) Constructs a new ConditionProfileActivator with the necessary dependencies. -
Method Summary
Modifier and TypeMethodDescriptionboolean
isActive
(Profile profile, ProfileActivationContext context, ModelProblemCollector problems) Determines whether a profile should be active based on its condition.boolean
presentInConfig
(Profile profile, ProfileActivationContext context, ModelProblemCollector problems) Checks if the condition is present in the profile's configuration.registerFunctions
(ProfileActivationContext context, VersionParser versionParser) Registers the condition functions that can be used in profile activation expressions.
-
Constructor Details
-
ConditionProfileActivator
Constructs a new ConditionProfileActivator with the necessary dependencies.- Parameters:
versionParser
- The parser for handling version comparisons
-
-
Method Details
-
isActive
public boolean isActive(Profile profile, ProfileActivationContext context, ModelProblemCollector problems) Determines whether a profile should be active based on its condition.- Specified by:
isActive
in interfaceProfileActivator
- Parameters:
profile
- The profile to evaluatecontext
- The context in which the profile is being evaluatedproblems
- A collector for any problems encountered during evaluation- Returns:
- true if the profile should be active, false otherwise
-
presentInConfig
public boolean presentInConfig(Profile profile, ProfileActivationContext context, ModelProblemCollector problems) Checks if the condition is present in the profile's configuration.- Specified by:
presentInConfig
in interfaceProfileActivator
- Parameters:
profile
- The profile to checkcontext
- The context in which the profile is being evaluatedproblems
- A collector for any problems encountered during evaluation- Returns:
- true if the condition is present and not blank, false otherwise
-
registerFunctions
public static Map<String,ConditionParser.ExpressionFunction> registerFunctions(ProfileActivationContext context, VersionParser versionParser) Registers the condition functions that can be used in profile activation expressions.- Parameters:
context
- The profile activation contextversionParser
- The parser for handling version comparisons- Returns:
- A map of function names to their implementations
-