Coverage Report - org.apache.maven.plugin.war.ReflectionProperties
 
Classes in this File Line Coverage Branch Coverage Complexity
ReflectionProperties
78% 
N/A 
1.667
 
 1  
 package org.apache.maven.plugin.war;
 2  
 
 3  
 /*
 4  
  * Copyright 2001-2006 The Apache Software 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 org.apache.maven.project.MavenProject;
 20  
 import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
 21  
 
 22  
 import java.util.AbstractMap;
 23  
 import java.util.Set;
 24  
 
 25  
 /**
 26  
  * @version $Id: ReflectionProperties.java 417362 2006-06-27 07:30:32Z brett $
 27  
  * @todo merge with resources/assembly plugin
 28  
  */
 29  
 public class ReflectionProperties
 30  
     extends AbstractMap
 31  
 {
 32  
     private MavenProject project;
 33  
 
 34  
     public ReflectionProperties( MavenProject project )
 35  18
     {
 36  18
         this.project = project;
 37  18
     }
 38  
 
 39  
     public synchronized Object get( Object key )
 40  
     {
 41  54
         Object value = null;
 42  
         try
 43  
         {
 44  54
             value = ReflectionValueExtractor.evaluate( String.valueOf( key ), project );
 45  
         }
 46  0
         catch ( Exception e )
 47  
         {
 48  
             //TODO: remove the try-catch block when ReflectionValueExtractor.evaluate() throws no more exceptions
 49  54
         }
 50  54
         return value;
 51  
     }
 52  
 
 53  
     public Set entrySet()
 54  
     {
 55  0
         throw new UnsupportedOperationException( "Cannot enumerate properties in a project" );
 56  
     }
 57  
 }