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       * See {@link org.codehaus.plexus.interpolation.Interpolator#interpolate(String, String, org.codehaus.plexus.interpolation.RecursionInterceptor)}.
26       * <p>
27       * This method triggers the use of a {@link org.codehaus.plexus.interpolation.SimpleRecursionInterceptor}
28       * instance for protection against expression cycles. It also leaves empty the
29       * expression prefix which would otherwise be trimmed from expressions. The
30       * result is that any detected expression will be resolved as-is.</p>
31       *
32       * @param input The input string to interpolate
33       * @return the interpolated string.
34       * @throws InterpolationException in case of an error.
35       */
36      String interpolate(String input) throws InterpolationException;
37  
38      /**
39       * See {@link org.codehaus.plexus.interpolation.Interpolator#interpolate(String, String, org.codehaus.plexus.interpolation.RecursionInterceptor)}.
40       * <p>
41       * This method leaves empty the expression prefix which would otherwise be
42       * trimmed from expressions. The result is that any detected expression will
43       * be resolved as-is.</p>
44       *
45       * @param input The input string to interpolate
46       *
47       * @param recursionInterceptor Used to protect the interpolation process
48       *                             from expression cycles, and throw an
49       *                             exception if one is detected.
50       * @return the interpolated string.
51       * @throws InterpolationException in case of an error.
52       */
53      String interpolate(String input, RecursionInterceptor recursionInterceptor) throws InterpolationException;
54  }