Coverage Report - com.lexicalscope.jewel.cli.specification.OptionSpecification
 
Classes in this File Line Coverage Branch Coverage Complexity
OptionSpecification
N/A
N/A
1
 
 1  
 //
 2  
 //Author       : t.wood
 3  
 //Copyright    : (c) Teamphone.com Ltd. 2008 - All Rights Reserved
 4  
 //
 5  
 package com.lexicalscope.jewel.cli.specification;
 6  
 
 7  
 import java.util.List;
 8  
 
 9  
 import com.lexicalscope.fluentreflection.FluentMethod;
 10  
 
 11  
 /**
 12  
  * Specifies an Option
 13  
  *
 14  
  * BETA: unstable may change in future versions
 15  
  *
 16  
  * @author t.wood
 17  
  */
 18  
 public interface OptionSpecification
 19  
 {
 20  
     /**
 21  
      * Get a description of the option. The description can be specified in the
 22  
      * <code>Option</code> annotation
 23  
      *
 24  
      * @see com.lexicalscope.jewel.cli.Option
 25  
      *
 26  
      * @return a description of the option
 27  
      */
 28  
     String getDescription();
 29  
 
 30  
     /**
 31  
      * Each argument to this option must conform to the type returned by this
 32  
      * method
 33  
      *
 34  
      * @return the type that each argument must conform to
 35  
      */
 36  
     Class<?> getType();
 37  
 
 38  
     /**
 39  
      * Canonical identifier for the option
 40  
      *
 41  
      * @return the canonical identifier for the option
 42  
      */
 43  
     String getCanonicalIdentifier();
 44  
 
 45  
     /**
 46  
      * Are multiple arguments allowed?
 47  
      *
 48  
      * @return True iff the the option takes multiple arguments
 49  
      */
 50  
     boolean isMultiValued();
 51  
 
 52  
     /**
 53  
      * Does the option have a value
 54  
      *
 55  
      * @return true iff the option has at least one value
 56  
      */
 57  
     boolean hasValue();
 58  
 
 59  
     /**
 60  
      * Is the argument optional
 61  
      *
 62  
      * @return is the argument optional
 63  
      */
 64  
     boolean isOptional();
 65  
 
 66  
     /**
 67  
      * Get the default values which will be used if the option is not specified
 68  
      * by the user.
 69  
      *
 70  
      * @return The default values which will be used if the option is not
 71  
      *         present
 72  
      */
 73  
     List<String> getDefaultValue();
 74  
 
 75  
     /**
 76  
      * Is there a default value to use if this option is not present? Options
 77  
      * with a default value are assumed to be optional.
 78  
      *
 79  
      * @return true iff this option has a default value
 80  
      */
 81  
     boolean hasDefaultValue();
 82  
 
 83  
     /**
 84  
      * Is the option hidden from help messages?
 85  
      *
 86  
      * @return true iff the option is hidden from help messages
 87  
      */
 88  
     boolean isHidden();
 89  
 
 90  
     /**
 91  
      * Is the option allowed to have this many values?
 92  
      *
 93  
      * @param count the number of values that the option might have
 94  
      *
 95  
      * @return true iff the count is a valid number of values for this option
 96  
      */
 97  
     boolean allowedThisManyValues(int count);
 98  
 
 99  
     FluentMethod getMethod();
 100  
 
 101  
     FluentMethod getOptionalityMethod();
 102  
 
 103  
     boolean hasExactCount();
 104  
 
 105  
     int exactly();
 106  
 
 107  
     int minimum();
 108  
 
 109  
     int maximum();
 110  
 
 111  
     int maximumArgumentConsumption();
 112  
 
 113  
     <T> T compareCountToSpecification(int valueCount, SpecificationMultiplicity<T> specificationMultiplicity);
 114  
 }