Coverage Report - org.codehaus.plexus.interpolation.PrefixedPropertiesValueSource
 
Classes in this File Line Coverage Branch Coverage Complexity
PrefixedPropertiesValueSource
0 %
0/5
N/A
1
 
 1  
 package org.codehaus.plexus.interpolation;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import java.util.List;
 23  
 import java.util.Properties;
 24  
 
 25  
 /**
 26  
  * Legacy support. Allow trimming one of a set of expression prefixes, the lookup
 27  
  * the remaining expression as a literal key from the wrapped properties instance.
 28  
  * <br/>
 29  
  * This is just a convenience implementation to provide a shorthand for constructing
 30  
  * the properties value source and then wrapping it with a prefixed value-source wrapper.
 31  
  *
 32  
  * @version $Id$
 33  
  */
 34  
 public class PrefixedPropertiesValueSource
 35  
     extends AbstractDelegatingValueSource
 36  
     implements QueryEnabledValueSource
 37  
 {
 38  
 
 39  
     /**
 40  
      * Wrap the specified properties file with a new {@link PropertiesBasedValueSource}, then
 41  
      * wrap that source with a new {@link PrefixedValueSourceWrapper} that uses the specified
 42  
      * expression prefix. Finally, set this wrapper source as a delegate for this
 43  
      * instance to use.
 44  
      *
 45  
      * @param prefix     The expression prefix to trim
 46  
      * @param properties The properties instance to wrap
 47  
      */
 48  
     public PrefixedPropertiesValueSource( String prefix, Properties properties )
 49  
     {
 50  0
         super( new PrefixedValueSourceWrapper( new PropertiesBasedValueSource( properties ), prefix ) );
 51  0
     }
 52  
 
 53  
     /**
 54  
      * Wrap the specified properties file with a new {@link PropertiesBasedValueSource}, then
 55  
      * wrap that source with a new {@link PrefixedValueSourceWrapper} that uses the specified
 56  
      * expression-prefix list. Finally, set this wrapper source as a delegate for this
 57  
      * instance to use.
 58  
      *
 59  
      * @param possiblePrefixes The expression-prefix list to trim
 60  
      * @param properties       The properties instance to wrap
 61  
      */
 62  
     public PrefixedPropertiesValueSource( List<String> possiblePrefixes, Properties properties,
 63  
                                           boolean allowUnprefixedExpressions )
 64  
     {
 65  0
         super( new PrefixedValueSourceWrapper( new PropertiesBasedValueSource( properties ), possiblePrefixes,
 66  
                                                allowUnprefixedExpressions ) );
 67  0
     }
 68  
 
 69  
     /**
 70  
      * {@inheritDoc}
 71  
      */
 72  
     public String getLastExpression()
 73  
     {
 74  0
         return ( (QueryEnabledValueSource) getDelegate() ).getLastExpression();
 75  
     }
 76  
 
 77  
 }