1 package org.apache.maven.shared.model.fileset.mappers;
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 /**
23 * Interface used by SourceFileScanner
24 * to find the name of the target file(s) corresponding to a
25 * source file.
26 *
27 * <p>The rule by which the file names are transformed is specified
28 * via the setFrom and setTo methods. The exact meaning of these is
29 * implementation dependent.</p>
30 */
31 public interface FileNameMapper
32 {
33 /**
34 * Sets the from part of the transformation rule.
35 *
36 * @param from the source
37 */
38 void setFrom( String from );
39
40 /**
41 * Sets the to part of the transformation rule.
42 *
43 * @param to the destination
44 */
45 void setTo( String to );
46
47 /**
48 * Returns the target filename for the
49 * given source file.
50 *
51 * <p>If the given rule doesn't apply to the source file,
52 * the implementation must return null. SourceFileScanner will then
53 * omit the source file in question.</p>
54 *
55 * @param sourceFileName the name of the source file relative to some given base directory
56 * @return the target filename for the given source file
57 */
58 String mapFileName( String sourceFileName );
59 }