Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (C) 2011 Tatsuhiro Tsujikawa
   *
   * Permission is hereby granted, free of charge, to any person
   * obtaining a copy of this software and associated documentation
   * files (the "Software"), to deal in the Software without
   * restriction, including without limitation the rights to use, copy,
   * modify, merge, publish, distribute, sublicense, and/or sell copies
   * of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
  *
  * The above copyright notice and this permission notice shall be
  * included in all copies or substantial portions of the Software.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
 package net.sourceforge.argparse4j.impl;
 
 import java.util.List;
 

This class provides useful shortcuts and constants.

They are mainly used to specify parameter to net.sourceforge.argparse4j.inf.Argument object.

 
 public final class Arguments {

    
Intentionally made private to avoid instantiation in application code.
 
     private Arguments() {
     }

    

Creates new range constrained choice.

The value specified in command line will be checked to see whether it fits in given range [min, max], inclusive.

Parameters:
min The lowerbound of the range, inclusive.
max The upperbound of the range, inclusive.
Returns:
net.sourceforge.argparse4j.impl.choice.RangeArgumentChoice object.
 
     public static <T extends Comparable<T>> RangeArgumentChoice<T> range(T min,
             T max) {
         return new RangeArgumentChoice<T>(minmax);
     }
 
     private static final StoreArgumentAction store_ = new StoreArgumentAction();
     private static final StoreTrueArgumentAction storeTrue_ = new StoreTrueArgumentAction();
     private static final StoreFalseArgumentAction storeFalse_ = new StoreFalseArgumentAction();
     private static final StoreConstArgumentAction storeConst_ = new StoreConstArgumentAction();
     private static final AppendArgumentAction append_ = new AppendArgumentAction();
     private static final AppendConstArgumentAction appendConst_ = new AppendConstArgumentAction();
     private static final HelpArgumentAction help_ = new HelpArgumentAction();
     private static final VersionArgumentAction version_ = new VersionArgumentAction();
     private static final CountArgumentAction count_ = new CountArgumentAction();

    

The value of net.sourceforge.argparse4j.inf.FeatureControl.SUPPRESS.

If value is used with net.sourceforge.argparse4j.inf.Argument.setDefault(net.sourceforge.argparse4j.inf.FeatureControl), no attribute is added if the command line argument was not present. Otherwise, the default value, which defaults to null, will be added to the object, regardless of the presence of command line argument, returned by net.sourceforge.argparse4j.inf.ArgumentParser.parseArgs(java.lang.String[]).

    public static final FeatureControl SUPPRESS = .;

    
Returns store action.

    public static StoreArgumentAction store() {
        return ;
    }

    

Returns storeTrue action.

If this action is used, the value specified using net.sourceforge.argparse4j.inf.Argument.nargs(int) will be ignored.

    public static StoreTrueArgumentAction storeTrue() {
        return ;
    }

    

Returns storeFalse action.

If this action is used, the value specified using net.sourceforge.argparse4j.inf.Argument.nargs(int) will be ignored.

    public static StoreFalseArgumentAction storeFalse() {
        return ;
    }

    

Returns storeConst action.

If this action is used, the value specified using net.sourceforge.argparse4j.inf.Argument.nargs(int) will be ignored.

    public static StoreConstArgumentAction storeConst() {
        return ;
    }

    

Returns append action.

If this action is used, the attribute will be of type java.util.List. If used with net.sourceforge.argparse4j.inf.Argument.nargs(int), the element of List will be List. This is because net.sourceforge.argparse4j.inf.Argument.nargs(int) produces List.

    public static AppendArgumentAction append() {
        return ;
    }

    

Returns appendConst action.

If this action is used, the value specified using net.sourceforge.argparse4j.inf.Argument.nargs(int) will be ignored.

    public static AppendConstArgumentAction appendConst() {
        return ;
    }

    

Returns help action.

This is used for an option printing help message. Please note that this action terminates program after printing help message.

    public static HelpArgumentAction help() {
        return ;
    }

    

Returns version action.

This is used for an option printing version message. Please note that this action terminates program after printing version message.

    public static VersionArgumentAction version() {
        return ;
    }

    

Returns count action.

This action counts the number of occurrence of the option. This action does not consume argument.

    public static CountArgumentAction count() {
        return ;
    }

    

Returns net.sourceforge.argparse4j.impl.type.EnumArgumentType with given enum type.

Since enum does not have a constructor with string argument, you cannot use net.sourceforge.argparse4j.inf.Argument.type(java.lang.Class). Instead use this convenient function.

Parameters:
type The enum type
Returns:
net.sourceforge.argparse4j.impl.type.EnumArgumentType object
    public static <T extends Enum<T>> EnumArgumentType<T> enumType(Class<T> type) {
        return new EnumArgumentType<T>(type);
    }

    
    public static FileArgumentType fileType() {
        return new FileArgumentType();
    }
New to GrepCode? Check out our FAQ X