~ubuntu-branches/ubuntu/quantal/maven-enforcer/quantal

« back to all changes in this revision

Viewing changes to enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/utils/MockEnforcerExpressionEvaluator.java

  • Committer: Bazaar Package Importer
  • Author(s): Gabriele Giacone
  • Date: 2010-03-01 02:28:06 UTC
  • Revision ID: james.westby@ubuntu.com-20100301022806-b6rx5ndd26peklkr
Tags: upstream-1.0~beta2
ImportĀ upstreamĀ versionĀ 1.0~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Licensed to the Apache Software Foundation (ASF) under one
 
3
 * or more contributor license agreements.  See the NOTICE file
 
4
 * distributed with this work for additional information
 
5
 * regarding copyright ownership.  The ASF licenses this file
 
6
 * to you under the Apache License, Version 2.0 (the
 
7
 * "License"); you may not use this file except in compliance
 
8
 * with the License.  You may obtain a copy of the License at
 
9
 *
 
10
 *  http://www.apache.org/licenses/LICENSE-2.0
 
11
 *
 
12
 * Unless required by applicable law or agreed to in writing,
 
13
 * software distributed under the License is distributed on an
 
14
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 
15
 * KIND, either express or implied.  See the License for the
 
16
 * specific language governing permissions and limitations
 
17
 * under the License.
 
18
 */
 
19
package org.apache.maven.plugins.enforcer.utils;
 
20
 
 
21
import org.apache.maven.execution.MavenSession;
 
22
import org.apache.maven.plugins.enforcer.EnforcerExpressionEvaluator;
 
23
import org.apache.maven.project.MavenProject;
 
24
import org.apache.maven.project.path.PathTranslator;
 
25
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
 
26
 
 
27
// TODO: Auto-generated Javadoc
 
28
/**
 
29
 * The Class MockEnforcerExpressionEvaluator.
 
30
 */
 
31
public class MockEnforcerExpressionEvaluator
 
32
    extends EnforcerExpressionEvaluator
 
33
{
 
34
 
 
35
    /**
 
36
     * Instantiates a new mock enforcer expression evaluator.
 
37
     * 
 
38
     * @param theContext the the context
 
39
     * @param thePathTranslator the the path translator
 
40
     * @param theProject the the project
 
41
     */
 
42
    public MockEnforcerExpressionEvaluator( MavenSession theContext, PathTranslator thePathTranslator,
 
43
                                            MavenProject theProject )
 
44
    {
 
45
        super( theContext, thePathTranslator, theProject );
 
46
        // TODO Auto-generated constructor stub
 
47
    }
 
48
 
 
49
    /*
 
50
     * (non-Javadoc)
 
51
     * 
 
52
     * @see org.apache.maven.plugin.PluginParameterExpressionEvaluator#evaluate(java.lang.String)
 
53
     */
 
54
    public Object evaluate( String expr )
 
55
        throws ExpressionEvaluationException
 
56
    {
 
57
        if ( expr != null )
 
58
        {
 
59
            // just remove the ${ } and return the name as the value
 
60
            return expr.replaceAll( "\\$\\{|}", "" );
 
61
        }
 
62
        else
 
63
        {
 
64
            return expr;
 
65
        }
 
66
    }
 
67
 
 
68
}