private <V> List<V> defaultValueFor( OptionSpec<V> option ) { return defaultValuesFor( option.options().iterator().next() ); }
private <V> List<V> defaultValueFor( OptionSpec<V> option ) { return defaultValuesFor( option.options().iterator().next() ); } }
private <V> List<V> defaultValueFor( OptionSpec<V> option ) { return defaultValuesFor( option.options().iterator().next() ); } }
private <V> List<V> defaultValueFor( OptionSpec<V> option ) { return defaultValuesFor( option.options().iterator().next() ); } }
/** * <p>Gives any arguments associated with the given option. If the option was given an argument type, the * arguments will take on that type; otherwise, they will be {@link String}s.</p> * * @param option the option to search for * @return the arguments associated with the option, as a list of objects of the type given to the arguments; an * empty list if no such arguments are present, or if the option was not detected * @throws NullPointerException if {@code option} is {@code null} */ public List<?> valuesOf( String option ) { requireNonNull( option ); AbstractOptionSpec<?> spec = detectedOptions.get( option ); return spec == null ? defaultValuesFor( option ) : valuesOf( spec ); }
/** * <p>Gives any arguments associated with the given option. If the option was given an argument type, the * arguments will take on that type; otherwise, they will be {@link String}s.</p> * * @param option the option to search for * @return the arguments associated with the option, as a list of objects of the type given to the arguments; an * empty list if no such arguments are present, or if the option was not detected * @throws NullPointerException if {@code option} is {@code null} */ public List<?> valuesOf( String option ) { requireNonNull( option ); AbstractOptionSpec<?> spec = detectedOptions.get( option ); return spec == null ? defaultValuesFor( option ) : valuesOf( spec ); }
private <V> List<V> defaultValueFor( OptionSpec<V> option ) { return defaultValuesFor( option.options().iterator().next() ); }
/** * Gives the argument associated with the given option. If the option was given an argument type, the argument * will take on that type; otherwise, it will be a {@link String}. * * <p>Specifying a {@linkplain ArgumentAcceptingOptionSpec#defaultsTo(Object, Object[]) default argument value} * for an option will cause this method to return that default value even if the option was not detected on the * command line, or if the option can take an optional argument but did not have one on the command line.</p> * * @param option the option to search for * @return the argument of the given option; {@code null} if no argument is present, or that option was not * detected * @throws NullPointerException if {@code option} is {@code null} * @throws OptionException if more than one argument was detected for the option */ public Object valueOf( String option ) { requireNonNull( option ); AbstractOptionSpec<?> spec = detectedOptions.get( option ); if ( spec == null ) { List<?> defaults = defaultValuesFor( option ); return defaults.isEmpty() ? null : defaults.get( 0 ); } return valueOf( spec ); }
/** * Gives the argument associated with the given option. If the option was given an argument type, the argument * will take on that type; otherwise, it will be a {@link String}. * * <p>Specifying a {@linkplain ArgumentAcceptingOptionSpec#defaultsTo(Object, Object[]) default argument value} * for an option will cause this method to return that default value even if the option was not detected on the * command line, or if the option can take an optional argument but did not have one on the command line.</p> * * @param option the option to search for * @return the argument of the given option; {@code null} if no argument is present, or that option was not * detected * @throws NullPointerException if {@code option} is {@code null} * @throws OptionException if more than one argument was detected for the option */ public Object valueOf( String option ) { requireNonNull( option ); AbstractOptionSpec<?> spec = detectedOptions.get( option ); if ( spec == null ) { List<?> defaults = defaultValuesFor( option ); return defaults.isEmpty() ? null : defaults.get( 0 ); } return valueOf( spec ); }
/** * <p>Gives any arguments associated with the given option. If the option was given an argument type, the * arguments will take on that type; otherwise, they will be {@link String}s.</p> * * @param option the option to search for * @return the arguments associated with the option, as a list of objects of the type given to the arguments; an * empty list if no such arguments are present, or if the option was not detected * @throws NullPointerException if {@code option} is {@code null} */ public List<?> valuesOf( String option ) { ensureNotNull( option ); AbstractOptionSpec<?> spec = detectedOptions.get( option ); return spec == null ? defaultValuesFor( option ) : valuesOf( spec ); }
/** * <p>Gives any arguments associated with the given option. If the option was given an argument type, the * arguments will take on that type; otherwise, they will be {@link String}s.</p> * * @param option the option to search for * @return the arguments associated with the option, as a list of objects of the type given to the arguments; an * empty list if no such arguments are present, or if the option was not detected * @throws NullPointerException if {@code option} is {@code null} */ public List<?> valuesOf( String option ) { ensureNotNull( option ); AbstractOptionSpec<?> spec = detectedOptions.get( option ); return spec == null ? defaultValuesFor( option ) : valuesOf( spec ); }
/** * <p>Gives any arguments associated with the given option. If the option was given an argument type, the * arguments will take on that type; otherwise, they will be {@link String}s.</p> * * @param option the option to search for * @return the arguments associated with the option, as a list of objects of the type given to the arguments; an * empty list if no such arguments are present, or if the option was not detected * @throws NullPointerException if {@code option} is {@code null} */ public List<?> valuesOf( String option ) { ensureNotNull( option ); AbstractOptionSpec<?> spec = detectedOptions.get( option ); return spec == null ? defaultValuesFor( option ) : valuesOf( spec ); }
/** * Gives the argument associated with the given option. If the option was given an argument type, the argument * will take on that type; otherwise, it will be a {@link String}. * * <p>Specifying a {@linkplain ArgumentAcceptingOptionSpec#defaultsTo(Object, Object[]) default argument value} * for an option will cause this method to return that default value even if the option was not detected on the * command line, or if the option can take an optional argument but did not have one on the command line.</p> * * @param option the option to search for * @return the argument of the given option; {@code null} if no argument is present, or that option was not * detected * @throws NullPointerException if {@code option} is {@code null} * @throws OptionException if more than one argument was detected for the option */ public Object valueOf( String option ) { ensureNotNull( option ); AbstractOptionSpec<?> spec = detectedOptions.get( option ); if ( spec == null ) { List<?> defaults = defaultValuesFor( option ); return defaults.isEmpty() ? null : defaults.get( 0 ); } return valueOf( spec ); }
/** * Gives the argument associated with the given option. If the option was given an argument type, the argument * will take on that type; otherwise, it will be a {@link String}. * * <p>Specifying a {@linkplain ArgumentAcceptingOptionSpec#defaultsTo(Object, Object[]) default argument value} * for an option will cause this method to return that default value even if the option was not detected on the * command line, or if the option can take an optional argument but did not have one on the command line.</p> * * @param option the option to search for * @return the argument of the given option; {@code null} if no argument is present, or that option was not * detected * @throws NullPointerException if {@code option} is {@code null} * @throws OptionException if more than one argument was detected for the option */ public Object valueOf( String option ) { ensureNotNull( option ); AbstractOptionSpec<?> spec = detectedOptions.get( option ); if ( spec == null ) { List<?> defaults = defaultValuesFor( option ); return defaults.isEmpty() ? null : defaults.get( 0 ); } return valueOf( spec ); }
/** * Gives the argument associated with the given option. If the option was given an argument type, the argument * will take on that type; otherwise, it will be a {@link String}. * * <p>Specifying a {@linkplain ArgumentAcceptingOptionSpec#defaultsTo(Object, Object[]) default argument value} * for an option will cause this method to return that default value even if the option was not detected on the * command line, or if the option can take an optional argument but did not have one on the command line.</p> * * @param option the option to search for * @return the argument of the given option; {@code null} if no argument is present, or that option was not * detected * @throws NullPointerException if {@code option} is {@code null} * @throws OptionException if more than one argument was detected for the option */ public Object valueOf( String option ) { ensureNotNull( option ); AbstractOptionSpec<?> spec = detectedOptions.get( option ); if ( spec == null ) { List<?> defaults = defaultValuesFor( option ); return defaults.isEmpty() ? null : defaults.get( 0 ); } return valueOf( spec ); }