@Test public void testConvert() throws ArgumentParserException { PathArgumentType type = new PathArgumentType(); Path path = type.convert(null, null, "foobar"); assertEquals("foobar", path.getName()); path = new PathArgumentType().convert(null, null, "-"); assertEquals("-", path.getName()); }
@Override public Path convert(ArgumentParser parser, Argument arg, String value) throws ArgumentParserException { Path path; try { path = new Path(value); } catch (IllegalArgumentException e) { String localizedTypeName = HadoopExtensionResourceBundle .get(parser.getConfig().getLocale()).getString("path"); throw new ArgumentParserException( String.format(TextHelper.LOCALE_ROOT, MessageLocalization .localize(parser.getConfig().getResourceBundle(), "couldNotConvertToError"), value, localizedTypeName), e.getCause(), parser, arg); } return path; }
PathArgumentType implements ArgumentType<Path> { @Override public Path convert(ArgumentParser parser, Argument arg, String value) throws ArgumentParserException { Path path; try { path = new Path(value); } catch (IllegalArgumentException e) { String localizedTypeName = HadoopExtensionResourceBundle .get(parser.getConfig().getLocale()).getString("path"); throw new ArgumentParserException( String.format(TextHelper.LOCALE_ROOT, MessageLocalization .localize(parser.getConfig().getResourceBundle(), "couldNotConvertToError"), value, localizedTypeName), e.getCause(), parser, arg); } return path; } }
PathArgumentType implements ArgumentType<Path> { @Override public Path convert(ArgumentParser parser, Argument arg, String value) throws ArgumentParserException { Path path; try { path = new Path(value); } catch (IllegalArgumentException e) { String localizedTypeName = HadoopExtensionResourceBundle .get(parser.getConfig().getLocale()).getString("path"); throw new ArgumentParserException( String.format(TextHelper.LOCALE_ROOT, MessageLocalization .localize(parser.getConfig().getResourceBundle(), "couldNotConvertToError"), value, localizedTypeName), e.getCause(), parser, arg); } return path; } PathArgumentType(); }
PathArgumentType implements ArgumentType<Path> { @Override public Path convert(ArgumentParser parser, Argument arg, String value) throws ArgumentParserException { Path path; try { path = new Path(value); } catch (IllegalArgumentException e) { String localizedTypeName = HadoopExtensionResourceBundle .get(parser.getConfig().getLocale()).getString("path"); throw new ArgumentParserException( String.format(TextHelper.LOCALE_ROOT, MessageLocalization .localize(parser.getConfig().getResourceBundle(), "couldNotConvertToError"), value, localizedTypeName), e.getCause(), parser, arg); } return path; } PathArgumentType(); @Override Path convert(ArgumentParser parser, Argument arg,
            String value); }
PathArgumentType implements ArgumentType<Path> { @Override public Path convert(ArgumentParser parser, Argument arg, String value) throws ArgumentParserException { Path path; try { path = new Path(value); } catch (IllegalArgumentException e) { String localizedTypeName = HadoopExtensionResourceBundle .get(parser.getConfig().getLocale()).getString("path"); throw new ArgumentParserException( String.format(TextHelper.LOCALE_ROOT, MessageLocalization .localize(parser.getConfig().getResourceBundle(), "couldNotConvertToError"), value, localizedTypeName), e.getCause(), parser, arg); } return path; } PathArgumentType(); @Override Path convert(ArgumentParser parser, Argument arg,
            String value);  }