View Javadoc
1   package org.codehaus.plexus.interpolation;
2   /*
3    * Copyright 2014 Codehaus Foundation.
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  /**
19   * Knows how to do basic interpolation services.
20   *
21   * TODO: Really really needs a way to communicate errors.
22   */
23  public interface BasicInterpolator
24  {
25      /**
26       * See {@link org.codehaus.plexus.interpolation.Interpolator#interpolate(String, String, org.codehaus.plexus.interpolation.RecursionInterceptor)}.
27       * <p>
28       * This method triggers the use of a {@link org.codehaus.plexus.interpolation.SimpleRecursionInterceptor}
29       * instance for protection against expression cycles. It also leaves empty the
30       * expression prefix which would otherwise be trimmed from expressions. The
31       * result is that any detected expression will be resolved as-is.</p>
32       *
33       * @param input The input string to interpolate
34       * @return the interpolated string.
35       * @throws InterpolationException in case of an error.
36       */
37      String interpolate( String input )
38          throws InterpolationException;
39  
40      /**
41       * See {@link org.codehaus.plexus.interpolation.Interpolator#interpolate(String, String, org.codehaus.plexus.interpolation.RecursionInterceptor)}.
42       * <p>
43       * This method leaves empty the expression prefix which would otherwise be
44       * trimmed from expressions. The result is that any detected expression will
45       * be resolved as-is.</p>
46       *
47       * @param input The input string to interpolate
48       *
49       * @param recursionInterceptor Used to protect the interpolation process
50       *                             from expression cycles, and throw an
51       *                             exception if one is detected.
52       * @return the interpolated string.
53       * @throws InterpolationException in case of an error.
54       */
55      String interpolate( String input, RecursionInterceptor recursionInterceptor )
56          throws InterpolationException;
57  }