public Object convert(ArgumentParserImpl parser, String value) throws ArgumentParserException { Object obj = type_.convert(parser, this, value); if (choice_ != null && !choice_.contains(obj)) { throw new ArgumentParserException(String.format( TextHelper.LOCALE_ROOT, localize("invalidChoiceError"), value, choice_.textualFormat()), parser, this); } return obj; }
String[] resolveMetavar() { if (metavar_ == null) { if (choice_ == null) { if (type_ instanceof MetavarInference) { String[] metavar = ((MetavarInference) type_) .inferMetavar(); if (metavar != null) { return metavar; } } if (isNamedArgument()) { return new String[] { dest_.toUpperCase() }; } return new String[] { dest_ }; } return new String[] { choice_.textualFormat() }; } return metavar_; }
String[] resolveMetavar() { if (metavar_ == null) { if (choice_ == null) { if (type_ instanceof MetavarInference) { String[] metavar = ((MetavarInference) type_) .inferMetavar(); if (metavar != null) { return metavar; } } if (isNamedArgument()) { return new String[] { dest_.toUpperCase() }; } return new String[] { dest_ }; } return new String[] { choice_.textualFormat() }; } return metavar_; }
public Object convert(ArgumentParserImpl parser, String value) throws ArgumentParserException { Object obj = type_.convert(parser, this, value); if (choice_ != null && !choice_.contains(obj)) { throw new ArgumentParserException(String.format( TextHelper.LOCALE_ROOT, localize("invalidChoiceError"), value, choice_.textualFormat()), parser, this); } return obj; }