View Javadoc

1   /*
2    AbstractFilePatternOptionArgumentImpl.java
3    Creation date : 5/06/2010
4    Copyright © Benjamin Croizet (graffity2199@yahoo.fr)
5   
6    This program is free software; you can redistribute it and/or
7    modify it under the terms of the GNU General Public License
8    or GNU Lesser General Public License as published by the
9    Free Software Foundation; either version 3 of the License,
10   or (at your option) any later version.
11  
12   This program is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16  
17   You should have received copies of the GNU General Public License
18   and GNU Lesser General Public License along with this program;
19   if not, write to the Free Software Foundation, Inc.,
20   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21   http://www.fsf.org/licensing/licenses/gpl.html
22   http://www.gnu.org/licenses/lgpl.html
23   */
24  
25  package net.sourceforge.plantumldependency.commoncli.option.argument.impl.filepattern;
26  
27  import net.sourceforge.plantumldependency.commoncli.option.argument.AbstractOptionArgument;
28  
29  import org.apache.tools.ant.types.FileSet;
30  
31  /**
32   * An abstract implementation of the
33   * {@link net.sourceforge.plantumldependency.commoncli.option.argument.OptionArgument} interface,
34   * providing common behaviors for Ant {@link FileSet} arguments.
35   *
36   * @author Benjamin Croizet (<a href="mailto:graffity2199@yahoo.fr>graffity2199@yahoo.fr</a>)
37   * @since 1.3.0
38   * @version 1.3.0
39   */
40  public abstract class AbstractFilePatternOptionArgumentImpl extends AbstractOptionArgument < FileSet > {
41  
42      /** Serial version UID. */
43      private static final long serialVersionUID = -8732226016764025008L;
44  
45      /** The argument main usage constant. */
46      private static final String MAIN_USAGE = "FILE_PATTERN";
47  
48      /** The argument main usage description constant. */
49      private static final String USAGE_DESCRIPTION = MAIN_USAGE
50              + " specifies a file pattern, with the same syntax as ANT patterns. It means that \"**\", \"*\" or \"?\" special characters can be used. For more information, please consult http://ant.apache.org/manual/dirtasks.html.";
51  
52      /**
53       * Default constructor.
54       *
55       * @param optionArgumentIsMandatory
56       *            <code>true</code> if the argument is mandatory, <code>false</code> otherwise.
57       * @since 1.3.0
58       */
59      public AbstractFilePatternOptionArgumentImpl(final boolean optionArgumentIsMandatory) {
60          super(optionArgumentIsMandatory, new StringBuilder(USAGE_DESCRIPTION));
61      }
62  
63      /**
64       * Default constructor.
65       *
66       * @param optionArgumentIsMandatory
67       *            <code>true</code> if the argument is mandatory, <code>false</code> otherwise.
68       * @param fullArgumentDescription
69       *            the full argument usage description, explaining what the argument does (used for
70       *            helping message). <i>Note : a new {@link StringBuilder} is created.</i>
71       * @since 1.3.0
72       */
73      public AbstractFilePatternOptionArgumentImpl(final boolean optionArgumentIsMandatory,
74              final StringBuilder fullArgumentDescription) {
75          super(optionArgumentIsMandatory, fullArgumentDescription);
76      }
77  
78      /**
79       * {@inheritDoc}
80       *
81       * @since 1.3.0
82       */
83      @Override
84      protected String getMainUsageDescription() {
85          return MAIN_USAGE;
86      }
87  }