本文整理了Java中joptsimple.OptionSet.defaultValuesFor()
方法的一些代码示例,展示了OptionSet.defaultValuesFor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OptionSet.defaultValuesFor()
方法的具体详情如下:
包路径:joptsimple.OptionSet
类名称:OptionSet
方法名:defaultValuesFor
暂无
代码示例来源:origin: net.sf.jopt-simple/jopt-simple
private <V> List<V> defaultValueFor( OptionSpec<V> option ) {
return defaultValuesFor( option.options().iterator().next() );
}
代码示例来源:origin: io.snappydata/gemfire-joptsimple
private <V> List<V> defaultValueFor( OptionSpec<V> option ) {
return defaultValuesFor( option.options().iterator().next() );
}
}
代码示例来源:origin: org.apache.geode/geode-joptsimple
private <V> List<V> defaultValueFor( OptionSpec<V> option ) {
return defaultValuesFor( option.options().iterator().next() );
}
}
代码示例来源:origin: io.snappydata/gemfire-util
private <V> List<V> defaultValueFor( OptionSpec<V> option ) {
return defaultValuesFor( option.options().iterator().next() );
}
}
代码示例来源:origin: jopt-simple/jopt-simple
/**
* <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 );
}
代码示例来源:origin: net.sf.jopt-simple/jopt-simple
/**
* <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 );
}
代码示例来源:origin: jopt-simple/jopt-simple
private <V> List<V> defaultValueFor( OptionSpec<V> option ) {
return defaultValuesFor( option.options().iterator().next() );
}
代码示例来源:origin: net.sf.jopt-simple/jopt-simple
/**
* 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 );
}
代码示例来源:origin: jopt-simple/jopt-simple
/**
* 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 );
}
代码示例来源:origin: org.apache.geode/geode-joptsimple
/**
* <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 );
}
代码示例来源:origin: io.snappydata/gemfire-joptsimple
/**
* <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 );
}
代码示例来源:origin: io.snappydata/gemfire-util
/**
* <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 );
}
代码示例来源:origin: io.snappydata/gemfire-util
/**
* 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 );
}
代码示例来源:origin: io.snappydata/gemfire-joptsimple
/**
* 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 );
}
代码示例来源:origin: org.apache.geode/geode-joptsimple
/**
* 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 );
}
内容来源于网络,如有侵权,请联系作者删除!