Coverage Report - org.codehaus.plexus.interpolation.Interpolator
 
Classes in this File Line Coverage Branch Coverage Complexity
Interpolator
N/A
N/A
1
 
 1  
 package org.codehaus.plexus.interpolation;
 2  
 
 3  
 /*
 4  
  * Copyright 2001-2008 Codehaus Foundation.
 5  
  *
 6  
  * Licensed under the Apache License, Version 2.0 (the "License");
 7  
  * you may not use this file except in compliance with the License.
 8  
  * 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, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 import java.util.List;
 20  
 
 21  
 /**
 22  
  * Interpolator interface. Based on existing RegexBasedInterpolator interface.
 23  
  *
 24  
  * @author cstamas
 25  
  * @version $Id$
 26  
  */
 27  
 public interface Interpolator
 28  
     extends BasicInterpolator
 29  
 {
 30  
 
 31  
     /**
 32  
      * Add a new {@link ValueSource} to the stack used to resolve expressions
 33  
      * in this interpolator instance.
 34  
      */
 35  
     void addValueSource( ValueSource valueSource );
 36  
 
 37  
     /**
 38  
      * Remove the specified {@link ValueSource} from the stack used to resolve
 39  
      * expressions in this interpolator instance.
 40  
      */
 41  
     void removeValuesSource( ValueSource valueSource );
 42  
     
 43  
     /**
 44  
      * Add a new post-processor to handle final processing after 
 45  
      * recursively-interpolated value is determined.
 46  
      */
 47  
     void addPostProcessor( InterpolationPostProcessor postProcessor );
 48  
 
 49  
     /**
 50  
      * Remove the given post-processor.
 51  
      */
 52  
     void removePostProcessor( InterpolationPostProcessor postProcessor );
 53  
 
 54  
     /**
 55  
      * See {@link Interpolator#interpolate(String, String, RecursionInterceptor)}.
 56  
      * <br/>
 57  
      * This method triggers the use of a {@link SimpleRecursionInterceptor}
 58  
      * instance for protection against expression cycles.
 59  
      *
 60  
      * @param input The input string to interpolate
 61  
      *
 62  
      * @param thisPrefixPattern An optional pattern that should be trimmed from
 63  
      *                          the start of any expressions found in the input.
 64  
      */
 65  
     String interpolate( String input,
 66  
                         String thisPrefixPattern )
 67  
         throws InterpolationException;
 68  
 
 69  
     /**
 70  
      * Attempt to resolve all expressions in the given input string, using the
 71  
      * given pattern to first trim an optional prefix from each expression. The
 72  
      * supplied recursion interceptor will provide protection from expression
 73  
      * cycles, ensuring that the input can be resolved or an exception is
 74  
      * thrown.
 75  
      * <b>return an empty String if input is null</b>
 76  
      * @param input The input string to interpolate
 77  
      *
 78  
      * @param thisPrefixPattern An optional pattern that should be trimmed from
 79  
      *                          the start of any expressions found in the input.
 80  
      *
 81  
      * @param recursionInterceptor Used to protect the interpolation process
 82  
      *                             from expression cycles, and throw an
 83  
      *                             exception if one is detected.
 84  
      */
 85  
     String interpolate( String input,
 86  
                         String thisPrefixPattern,
 87  
                         RecursionInterceptor recursionInterceptor )
 88  
         throws InterpolationException;
 89  
 
 90  
     /**
 91  
      * Return any feedback messages and errors that were generated - but
 92  
      * suppressed - during the interpolation process. Since unresolvable
 93  
      * expressions will be left in the source string as-is, this feedback is
 94  
      * optional, and will only be useful for debugging interpolation problems.
 95  
      *
 96  
      * @return a {@link List} that may be interspersed with {@link String} and
 97  
      * {@link Throwable} instances.
 98  
      */
 99  
     List getFeedback();
 100  
 
 101  
     /**
 102  
      * Clear the feedback messages from previous interpolate(..) calls.
 103  
      */
 104  
     void clearFeedback();
 105  
     
 106  
     boolean isCacheAnswers();
 107  
 
 108  
     void setCacheAnswers( boolean cacheAnswers );
 109  
     
 110  
     void clearAnswers();
 111  
 }