View Javadoc

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 to be used by SourceFileScanner.
24   *
25   * <p>Used to find the name of the target file(s) corresponding to a
26   * source file.</p>
27   *
28   * <p>The rule by which the file names are transformed is specified
29   * via the setFrom and setTo methods. The exact meaning of these is
30   * implementation dependent.</p>
31   *
32   * @version $Id: FileNameMapper.html 886882 2013-11-16 21:55:43Z hboutemy $
33   */
34  public interface FileNameMapper
35  {
36      /**
37       * Sets the from part of the transformation rule.
38       *
39       * @param from
40       */
41      void setFrom( String from );
42  
43      /**
44       * Sets the to part of the transformation rule.
45       *
46       * @param to
47       */
48      void setTo( String to );
49  
50      /**
51       * Returns the target filename for the
52       * given source file.
53       *
54       * <p>if the given rule doesn't apply to the source file,
55       * implementation must return null. SourceFileScanner will then
56       * omit the source file in question.</p>
57       *
58       * @param sourceFileName the name of the source file relative to some given basedirectory.
59       * @return the target filename for the given source file.
60       */
61      String mapFileName( String sourceFileName );
62  }