View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  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,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.plugins.clean;
20  
21  import java.io.File;
22  import java.util.Arrays;
23  
24  /**
25   * Customizes the string representation of
26   * <code>org.apache.maven.shared.model.fileset.FileSet</code> to return the
27   * included and excluded files from the file-set's directory. Specifically,
28   * <code>"file-set: <I>[directory]</I> (included: <I>[included files]</I>,
29   * excluded: <I>[excluded files]</I>)"</code>
30   *
31   * @since 2.1
32   */
33  public class Fileset {
34  
35      private File directory;
36  
37      private String[] includes;
38  
39      private String[] excludes;
40  
41      private boolean followSymlinks;
42  
43      private boolean useDefaultExcludes;
44  
45      /**
46       * @return {@link #directory}
47       */
48      public File getDirectory() {
49          return directory;
50      }
51  
52      /**
53       * @return {@link #includes}
54       */
55      public String[] getIncludes() {
56          return (includes != null) ? includes : new String[0];
57      }
58  
59      /**
60       * @return {@link #excludes}
61       */
62      public String[] getExcludes() {
63          return (excludes != null) ? excludes : new String[0];
64      }
65  
66      /**
67       * @return {@link #followSymlinks}
68       */
69      public boolean isFollowSymlinks() {
70          return followSymlinks;
71      }
72  
73      /**
74       * @return {@link #useDefaultExcludes}
75       */
76      public boolean isUseDefaultExcludes() {
77          return useDefaultExcludes;
78      }
79  
80      /**
81       * Retrieves the included and excluded files from this file-set's directory.
82       * Specifically, <code>"file-set: <I>[directory]</I> (included:
83       * <I>[included files]</I>, excluded: <I>[excluded files]</I>)"</code>
84       *
85       * @return The included and excluded files from this file-set's directory.
86       * Specifically, <code>"file-set: <I>[directory]</I> (included:
87       * <I>[included files]</I>, excluded: <I>[excluded files]</I>)"</code>
88       * @see java.lang.Object#toString()
89       */
90      public String toString() {
91          return "file set: " + getDirectory() + " (included: " + Arrays.asList(getIncludes()) + ", excluded: "
92                  + Arrays.asList(getExcludes()) + ")";
93      }
94  }