Class ConditionProfileActivator
java.lang.Object
org.apache.maven.impl.model.profile.ConditionProfileActivator
- All Implemented Interfaces:
org.apache.maven.api.services.model.ProfileActivator
@Named("condition")
@Singleton
public class ConditionProfileActivator
extends Object
implements org.apache.maven.api.services.model.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
ConstructorsConstructorDescriptionConditionProfileActivator(org.apache.maven.api.services.VersionParser versionParser, org.apache.maven.api.services.Interpolator interpolator) Constructs a new ConditionProfileActivator with the necessary dependencies. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisActive(org.apache.maven.api.model.Profile profile, org.apache.maven.api.services.model.ProfileActivationContext context, org.apache.maven.api.services.ModelProblemCollector problems) Determines whether a profile should be active based on its condition.booleanpresentInConfig(org.apache.maven.api.model.Profile profile, org.apache.maven.api.services.model.ProfileActivationContext context, org.apache.maven.api.services.ModelProblemCollector problems) Checks if the condition is present in the profile's configuration.registerFunctions(org.apache.maven.api.services.model.ProfileActivationContext context, org.apache.maven.api.services.VersionParser versionParser) Registers the condition functions that can be used in profile activation expressions.
-
Constructor Details
-
ConditionProfileActivator
@Inject public ConditionProfileActivator(org.apache.maven.api.services.VersionParser versionParser, org.apache.maven.api.services.Interpolator interpolator) Constructs a new ConditionProfileActivator with the necessary dependencies.- Parameters:
versionParser- The parser for handling version comparisonsinterpolator- The interpolator for interpolating the values in the given map using the provided callback function
-
-
Method Details
-
isActive
public boolean isActive(org.apache.maven.api.model.Profile profile, org.apache.maven.api.services.model.ProfileActivationContext context, org.apache.maven.api.services.ModelProblemCollector problems) Determines whether a profile should be active based on its condition.- Specified by:
isActivein interfaceorg.apache.maven.api.services.model.ProfileActivator- 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(org.apache.maven.api.model.Profile profile, org.apache.maven.api.services.model.ProfileActivationContext context, org.apache.maven.api.services.ModelProblemCollector problems) Checks if the condition is present in the profile's configuration.- Specified by:
presentInConfigin interfaceorg.apache.maven.api.services.model.ProfileActivator- 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 Map<String, ConditionParser.ExpressionFunction> registerFunctions(org.apache.maven.api.services.model.ProfileActivationContext context, org.apache.maven.api.services.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
-