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      /**
36       * Traverse the object graph from the given starting point and interpolate 
37       * any Strings found in that graph using the given {@link Interpolator}.
38       * 
39       * @param target The starting point of the object graph to traverse
40       * @param interpolator The {@link Interpolator} used to resolve any Strings encountered during traversal.
41       * @throws InterpolationException in case of an error.
42       */
43      void interpolate( Object target, BasicInterpolator interpolator )
44          throws InterpolationException;
45      
46      /**
47       * Traverse the object graph from the given starting point and interpolate 
48       * any Strings found in that graph using the given {@link Interpolator}.
49       * 
50       * @param target The starting point of the object graph to traverse
51       * @param interpolator The {@link Interpolator} used to resolve any Strings encountered during traversal.
52       * @param recursionInterceptor The {@link RecursionInterceptor} used to detect cyclical expressions in the graph
53       * @throws InterpolationException in case of an error.
54       */
55      void interpolate( Object target, BasicInterpolator interpolator, RecursionInterceptor recursionInterceptor )
56          throws InterpolationException;
57  
58      /**
59       * Returns true if the last interpolation execution generated warnings.
60       * @return true/false.
61       */
62      boolean hasWarnings();
63      
64      /**
65       * Retrieve the {@link List} of warnings ({@link ObjectInterpolationWarning}
66       * instances) generated during the last interpolation execution.
67       * @return The list of warnings.
68       */
69      List getWarnings();
70  
71  }