Coverage Report - org.apache.maven.shared.io.scan.mapping.SingleTargetMapping
 
Classes in this File Line Coverage Branch Coverage Complexity
SingleTargetMapping
100 %
7/7
100 %
2/2
2
 
 1  
 package org.apache.maven.shared.io.scan.mapping;
 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 org.apache.maven.shared.io.scan.InclusionScanException;
 23  
 
 24  
 import java.util.Set;
 25  
 import java.util.Collections;
 26  
 import java.io.File;
 27  
 
 28  
 /**
 29  
  * Maps a set of input files to a single output file.
 30  
  *
 31  
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
 32  
  * @version $Id: SingleTargetMapping.java 595935 2007-11-17 11:39:34Z vsiveton $
 33  
  */
 34  
 public class SingleTargetMapping
 35  
     implements SourceMapping
 36  
 {
 37  
     private String sourceSuffix;
 38  
 
 39  
     private String outputFile;
 40  
 
 41  
     public SingleTargetMapping( String sourceSuffix, String outputFile )
 42  1
     {
 43  1
         this.sourceSuffix = sourceSuffix;
 44  
 
 45  1
         this.outputFile = outputFile;
 46  1
     }
 47  
 
 48  
     public Set getTargetFiles( File targetDir, String source )
 49  
         throws InclusionScanException
 50  
     {
 51  2
         if ( !source.endsWith( sourceSuffix ) )
 52  
         {
 53  1
             return Collections.EMPTY_SET;
 54  
         }
 55  
 
 56  1
         return Collections.singleton( new File( targetDir, outputFile ) );
 57  
     }
 58  
 }