Source for net.dpml.cli.Group

   1: /**
   2:  * Copyright 2003-2004 The Apache Software Foundation
   3:  *
   4:  * Licensed under the Apache License, Version 2.0 (the "License");
   5:  * you may not use this file except in compliance with the License.
   6:  * You may obtain a copy of the License at
   7:  *
   8:  *     http://www.apache.org/licenses/LICENSE-2.0
   9:  *
  10:  * Unless required by applicable law or agreed to in writing, software
  11:  * distributed under the License is distributed on an "AS IS" BASIS,
  12:  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13:  * See the License for the specific language governing permissions and
  14:  * limitations under the License.
  15:  */
  16: package net.dpml.cli;
  17: 
  18: import java.util.Comparator;
  19: import java.util.Set;
  20: 
  21: /**
  22:  * An Option representing a choice or group of Options in the form "-a|-b|-c".
  23:  */
  24: public interface Group extends Option 
  25: {
  26:     /**
  27:      * Appends usage information to the specified StringBuffer
  28:      * 
  29:      * @param buffer the buffer to append to
  30:      * @param helpSettings a set of display settings @see DisplaySetting
  31:      * @param comp a comparator used to sort the Options
  32:      * @param separator the String used to separate member Options 
  33:      */
  34:     void appendUsage(
  35:         final StringBuffer buffer,
  36:         final Set helpSettings,
  37:         final Comparator comp,
  38:         final String separator );
  39: 
  40:     /**
  41:      * Indicates whether group members must be present for the CommandLine to be
  42:      * valid.
  43:      *
  44:      * @see #getMinimum()
  45:      * @see #getMaximum()
  46:      * @return true iff the CommandLine will be invalid without at least one 
  47:      *         member option
  48:      */
  49:     boolean isRequired();
  50: 
  51:     /**
  52:      * Retrieves the minimum number of members required for a valid Group
  53:      *
  54:      * @return the minimum number of members
  55:      */
  56:     int getMinimum();
  57: 
  58:     /**
  59:      * Retrieves the maximum number of members acceptable for a valid Group
  60:      *
  61:      * @return the maximum number of members
  62:      */
  63:     int getMaximum();
  64: }