Class DefaultEnforcementRuleHelper
java.lang.Object
org.apache.maven.plugins.enforcer.internal.DefaultEnforcementRuleHelper
- All Implemented Interfaces:
EnforcerRuleHelper,org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator
Default implementation of the EnforcementRuleHelper interface. This is used to help retrieve information from the
session and provide useful elements like the log.
- Author:
- Brian Fox
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultEnforcementRuleHelper(org.apache.maven.execution.MavenSession session, org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator evaluator, org.apache.maven.plugin.logging.Log log, org.codehaus.plexus.PlexusContainer container) Instantiates a new default enforcement rule helper. -
Method Summary
Modifier and TypeMethodDescriptionalignToBaseDirectory(File file) Gets a cached value, or uses the provided producer to compute it.<T> TgetComponent(Class<T> clazz) Gets the component.<T> TgetComponent(Class<T> clazz, String roleHint) Gets the component.getComponent(String componentKey) Gets the component.getComponent(String role, String roleHint) Gets the component.getComponentList(String role) Gets the component list.getComponentMap(String role) Gets the component map.org.codehaus.plexus.PlexusContainerGets the container.org.apache.maven.plugin.logging.LoggetLog()Gets the log.
-
Constructor Details
-
DefaultEnforcementRuleHelper
public DefaultEnforcementRuleHelper(org.apache.maven.execution.MavenSession session, org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator evaluator, org.apache.maven.plugin.logging.Log log, org.codehaus.plexus.PlexusContainer container) Instantiates a new default enforcement rule helper.- Parameters:
session- the sessionevaluator- the evaluatorlog- the logcontainer- the container
-
-
Method Details
-
getLog
Description copied from interface:EnforcerRuleHelperGets the log.- Specified by:
getLogin interfaceEnforcerRuleHelper- Returns:
- the log
-
alignToBaseDirectory
- Specified by:
alignToBaseDirectoryin interfaceorg.codehaus.plexus.component.configurator.expression.ExpressionEvaluator
-
evaluate
public Object evaluate(String expression) throws org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException - Specified by:
evaluatein interfaceorg.codehaus.plexus.component.configurator.expression.ExpressionEvaluator- Throws:
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException
-
getComponent
public <T> T getComponent(Class<T> clazz) throws org.codehaus.plexus.component.repository.exception.ComponentLookupException Description copied from interface:EnforcerRuleHelperGets the component.- Specified by:
getComponentin interfaceEnforcerRuleHelper- Type Parameters:
T- a class type- Parameters:
clazz- the clazz- Returns:
- the component
- Throws:
org.codehaus.plexus.component.repository.exception.ComponentLookupException- the component lookup exception
-
getComponent
public Object getComponent(String componentKey) throws org.codehaus.plexus.component.repository.exception.ComponentLookupException Description copied from interface:EnforcerRuleHelperGets the component.- Specified by:
getComponentin interfaceEnforcerRuleHelper- Parameters:
componentKey- the component key- Returns:
- the component
- Throws:
org.codehaus.plexus.component.repository.exception.ComponentLookupException- the component lookup exception
-
getComponent
public Object getComponent(String role, String roleHint) throws org.codehaus.plexus.component.repository.exception.ComponentLookupException Description copied from interface:EnforcerRuleHelperGets the component.- Specified by:
getComponentin interfaceEnforcerRuleHelper- Parameters:
role- the roleroleHint- the role hint- Returns:
- the component
- Throws:
org.codehaus.plexus.component.repository.exception.ComponentLookupException- the component lookup exception
-
getComponentList
public List<Object> getComponentList(String role) throws org.codehaus.plexus.component.repository.exception.ComponentLookupException Description copied from interface:EnforcerRuleHelperGets the component list.- Specified by:
getComponentListin interfaceEnforcerRuleHelper- Parameters:
role- the role- Returns:
- the component list
- Throws:
org.codehaus.plexus.component.repository.exception.ComponentLookupException- the component lookup exception
-
getComponentMap
public Map<String,Object> getComponentMap(String role) throws org.codehaus.plexus.component.repository.exception.ComponentLookupException Description copied from interface:EnforcerRuleHelperGets the component map.- Specified by:
getComponentMapin interfaceEnforcerRuleHelper- Parameters:
role- the role- Returns:
- the component map
- Throws:
org.codehaus.plexus.component.repository.exception.ComponentLookupException- the component lookup exception
-
getComponent
public <T> T getComponent(Class<T> clazz, String roleHint) throws org.codehaus.plexus.component.repository.exception.ComponentLookupException Description copied from interface:EnforcerRuleHelperGets the component.- Specified by:
getComponentin interfaceEnforcerRuleHelper- Type Parameters:
T- a class type- Parameters:
clazz- the clazzroleHint- the role hint- Returns:
- the component
- Throws:
org.codehaus.plexus.component.repository.exception.ComponentLookupException- the component lookup exception
-
getContainer
Description copied from interface:EnforcerRuleHelperGets the container.- Specified by:
getContainerin interfaceEnforcerRuleHelper- Returns:
- the container
-
getCache
Description copied from interface:EnforcerRuleHelperGets a cached value, or uses the provided producer to compute it.- Specified by:
getCachein interfaceEnforcerRuleHelper- Parameters:
key- a key to identify the value storedproducer- a supplier for the value if it's not already present- Returns:
- a previously-cached or freshly-computed value
-