Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SingleTargetMapping |
|
| 2.0;2 |
1 | package org.apache.maven.shared.io.scan.mapping; | |
2 | ||
3 | /* | |
4 | * Copyright 2001-2005 The Apache Software Foundation. | |
5 | * | |
6 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | |
7 | * in compliance with the License. You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software distributed under the License | |
12 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | |
13 | * or implied. See the License for the specific language governing permissions and limitations under | |
14 | * the License. | |
15 | */ | |
16 | ||
17 | import org.apache.maven.shared.io.scan.InclusionScanException; | |
18 | ||
19 | import java.util.Set; | |
20 | import java.util.Collections; | |
21 | import java.io.File; | |
22 | ||
23 | /** | |
24 | * Maps a set of input files to a single output file. | |
25 | * | |
26 | * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a> | |
27 | * @version $Id: org.apache.maven.shared.io.scan.mapping.SingleTargetMapping.html 2271 2006-08-22 15:19:41Z joakime $ | |
28 | */ | |
29 | public class SingleTargetMapping | |
30 | implements SourceMapping | |
31 | { | |
32 | private String sourceSuffix; | |
33 | ||
34 | private String outputFile; | |
35 | ||
36 | 1 | public SingleTargetMapping( String sourceSuffix, String outputFile ) |
37 | { | |
38 | 1 | this.sourceSuffix = sourceSuffix; |
39 | ||
40 | 1 | this.outputFile = outputFile; |
41 | 1 | } |
42 | ||
43 | public Set getTargetFiles( File targetDir, String source ) | |
44 | throws InclusionScanException | |
45 | { | |
46 | 2 | if ( !source.endsWith( sourceSuffix ) ) |
47 | { | |
48 | 1 | return Collections.EMPTY_SET; |
49 | } | |
50 | ||
51 | 1 | return Collections.singleton( new File( targetDir, outputFile ) ); |
52 | } | |
53 | } |