View Javadoc
1   package org.codehaus.plexus.interpolation.object;
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  import org.codehaus.plexus.interpolation.BasicInterpolator;
22  import org.codehaus.plexus.interpolation.InterpolationException;
23  import org.codehaus.plexus.interpolation.Interpolator;
24  import org.codehaus.plexus.interpolation.RecursionInterceptor;
25  
26  /**
27   * Traverses an object graph and uses an {@link Interpolator} instance to resolve any String values in the
28   * graph.
29   *
30   * @author jdcasey
31   */
32  public interface ObjectInterpolator {
33  
34      /**
35       * Traverse the object graph from the given starting point and interpolate
36       * any Strings found in that graph using the given {@link Interpolator}.
37       *
38       * @param target The starting point of the object graph to traverse
39       * @param interpolator The {@link Interpolator} used to resolve any Strings encountered during traversal.
40       * @throws InterpolationException in case of an error.
41       */
42      void interpolate(Object target, BasicInterpolator interpolator) throws InterpolationException;
43  
44      /**
45       * Traverse the object graph from the given starting point and interpolate
46       * any Strings found in that graph using the given {@link Interpolator}.
47       *
48       * @param target The starting point of the object graph to traverse
49       * @param interpolator The {@link Interpolator} used to resolve any Strings encountered during traversal.
50       * @param recursionInterceptor The {@link RecursionInterceptor} used to detect cyclical expressions in the graph
51       * @throws InterpolationException in case of an error.
52       */
53      void interpolate(Object target, BasicInterpolator interpolator, RecursionInterceptor recursionInterceptor)
54              throws InterpolationException;
55  
56      /**
57       * Returns true if the last interpolation execution generated warnings.
58       * @return true/false.
59       */
60      boolean hasWarnings();
61  
62      /**
63       * Retrieve the {@link List} of warnings ({@link ObjectInterpolationWarning}
64       * instances) generated during the last interpolation execution.
65       * @return The list of warnings.
66       */
67      List getWarnings();
68  }