View Javadoc
1   package org.codehaus.plexus.interpolation.fixed;
2   
3   /*
4    * Copyright 2014 The 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  
20  
21  import java.util.List;
22  
23  /**
24   * Wraps an arbitrary object with an {@link org.codehaus.plexus.interpolation.fixed.ObjectBasedValueSource} instance, then
25   * wraps that source with a {@link org.codehaus.plexus.interpolation.fixed.PrefixedValueSourceWrapper} instance, to which
26   * this class delegates all of its calls.
27   */
28  public class PrefixedObjectValueSource
29      extends AbstractDelegatingValueSource
30  {
31  
32      /**
33       * Wrap the specified root object, allowing the specified expression prefix.
34       * @param prefix the prefix.
35       * @param root The root of the graph.
36       */
37      public PrefixedObjectValueSource( String prefix, Object root )
38      {
39          super( new PrefixedValueSourceWrapper( new ObjectBasedValueSource( root ), prefix ) );
40      }
41  
42      /**
43       * Wrap the specified root object, allowing the specified list of expression
44       * prefixes and setting whether the {@link org.codehaus.plexus.interpolation.PrefixedValueSourceWrapper} allows
45       * unprefixed expressions.
46       * @param possiblePrefixes The list of possible prefixed.
47       * @param root The root of the graph.
48       * @param allowUnprefixedExpressions allow unrefixed expressions or not.
49       */
50      public PrefixedObjectValueSource( List<String> possiblePrefixes, Object root, boolean allowUnprefixedExpressions )
51      {
52          super( new PrefixedValueSourceWrapper( new ObjectBasedValueSource( root ), possiblePrefixes,
53                                                 allowUnprefixedExpressions ) );
54      }
55  }