本文整理汇总了Java中io.airlift.airline.OptionType类的典型用法代码示例。如果您正苦于以下问题:Java OptionType类的具体用法?Java OptionType怎么用?Java OptionType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OptionType类属于io.airlift.airline包,在下文中一共展示了OptionType类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stacktraceIsSet
import io.airlift.airline.OptionType; //导入依赖的package包/类
/**
* We check if the option is set here rather than in each command
* to have a single place to catch all exceptions.
*
* Given that we first catch ParseArgumentsUnexpectedException we
* do expect that parsing the same input again will not throw an exception.
*/
private static boolean stacktraceIsSet(final GlobalMetadata globalMetadata, final String[] args) {
try {
Parser p = new Parser();
ListMultimap<OptionMetadata, Object> options = p.parse(globalMetadata, args).getParsedOptions();
for (Map.Entry<OptionMetadata, Collection<Object>> option : options.asMap().entrySet()) {
OptionMetadata metadata = option.getKey();
if (metadata.getOptionType() == OptionType.GLOBAL
&& metadata.getOptions().contains("--stacktrace")) {
return option.getValue().contains(true);
}
}
} catch (Exception e) {
System.err.println("Failed to determine if the stacktrace should be shown. Please report this bug.");
}
return false;
}