@Test public void missingArgsCausesHelp() throws IOException { ArgsForTest args = (ArgsForTest) new ArgsForTest().parse(new String[] {}); assertThat(args.status, is(1)); assertThat(new String(systemErrCapture.toByteArray(), StandardCharsets.UTF_8), is(containsString("--target"))); assertThat(new String(systemErrCapture.toByteArray(), StandardCharsets.UTF_8), is(containsString("--source"))); assertThat(new String(systemOutCapture.toByteArray(), StandardCharsets.UTF_8), is(containsString("Usage: jsonschema2pojo"))); }
public Arguments parse(String[] args) { JCommander jCommander = new JCommander(this); jCommander.setProgramName("jsonschema2pojo"); try { jCommander.parse(args); if (this.showHelp) { jCommander.usage(); exit(EXIT_OKAY); } } catch (ParameterException e) { System.err.println(e.getMessage()); jCommander.usage(); exit(EXIT_ERROR); } return this; }
Arguments implements GenerationConfig { public Arguments parse(String[] args) { JCommander jCommander = new JCommander(this); jCommander.setProgramName("jsonschema2pojo"); try { jCommander.parse(args); if (this.showHelp) { jCommander.usage(); exit(EXIT_OKAY); } } catch (ParameterException e) { System.err.println(e.getMessage()); jCommander.usage(); exit(EXIT_ERROR); } return this; } }
Arguments implements GenerationConfig { public Arguments parse(String[] args) { JCommander jCommander = new JCommander(this); jCommander.setProgramName("jsonschema2pojo"); try { jCommander.parse(args); if (this.showHelp) { jCommander.usage(); exit(EXIT_OKAY); } } catch (ParameterException e) { System.err.println(e.getMessage()); jCommander.usage(); exit(EXIT_ERROR); } return this; }  }
Arguments implements GenerationConfig { public Arguments parse(String[] args) { JCommander jCommander = new JCommander(this); jCommander.setProgramName("jsonschema2pojo"); try { jCommander.parse(args); if (this.showHelp) { jCommander.usage(); exit(EXIT_OKAY); } } catch (ParameterException e) { System.err.println(e.getMessage()); jCommander.usage(); exit(EXIT_ERROR); } return this; }  Arguments parse(String[] args); @Override Iterator<URL> getSource(); @Override File getTargetDirectory(); @Override String getTargetPackage(); @Override boolean isGenerateBuilders(); @Override boolean isIncludeTypeInfo(); String getLogLevel(); @Override boolean isUseInnerClassBuilders(); @Override boolean isIncludeConstructorPropertiesAnnotation(); @Override boolean isUsePrimitives(); @Override char[] getPropertyWordDelimiters(); @Override boolean isUseLongIntegers(); @Override boolean isUseDoubleNumbers(); @Override boolean isIncludeHashcodeAndEquals(); @Override boolean isIncludeToString(); @Override String[] getToStringExcludes(); @Override AnnotationStyle getAnnotationStyle(); @Override boolean isUseTitleAsClassname(); @Override InclusionLevel getInclusionLevel(); @Override Class<? extends Annotator> getCustomAnnotator(); @Override Class<? extends RuleFactory> getCustomRuleFactory(); @Override boolean isIncludeJsr303Annotations(); @Override boolean isIncludeJsr305Annotations(); @Override boolean isUseOptionalForGetters(); @Override SourceType getSourceType(); @Override boolean isRemoveOldOutput(); @Override String getOutputEncoding(); @Override boolean isUseJodaDates(); @Override boolean isUseJodaLocalDates(); @Override boolean isUseJodaLocalTimes(); boolean isUseCommonsLang3(); @Override boolean isParcelable(); @Override boolean isSerializable(); @Override FileFilter getFileFilter(); @Override boolean isInitializeCollections(); @Override String getClassNamePrefix(); @Override String getClassNameSuffix(); @Override String[] getFileExtensions(); @Override boolean isIncludeConstructors(); @Override boolean isConstructorsRequiredPropertiesOnly(); boolean isPrintLogLevels(); @Override boolean isIncludeRequiredPropertiesConstructor(); @Override boolean isIncludeAllPropertiesConstructor(); @Override boolean isIncludeCopyConstructor(); @Override boolean isIncludeAdditionalProperties(); @Override boolean isIncludeGetters(); @Override boolean isIncludeSetters(); @Override String getTargetVersion(); @Override boolean isIncludeDynamicAccessors(); @Override boolean isIncludeDynamicGetters(); @Override boolean isIncludeDynamicSetters(); @Override boolean isIncludeDynamicBuilders(); @Override String getDateTimeType(); @Override String getDateType(); @Override String getTimeType(); @Override boolean isUseBigIntegers(); @Override boolean isUseBigDecimals(); @Override boolean isFormatDateTimes(); @Override boolean isFormatDates(); @Override boolean isFormatTimes(); @Override String getRefFragmentPathDelimiters(); @Override String getCustomDatePattern(); @Override String getCustomTimePattern(); @Override String getCustomDateTimePattern(); @Override SourceSortOrder getSourceSortOrder(); @Override Language getTargetLanguage(); @Override Map<String, String> getFormatTypeMapping(); }
Arguments implements GenerationConfig { public Arguments parse(String[] args) { JCommander jCommander = new JCommander(this); jCommander.setProgramName("jsonschema2pojo"); try { jCommander.parse(args); if (this.showHelp) { jCommander.usage(); exit(EXIT_OKAY); } } catch (ParameterException e) { System.err.println(e.getMessage()); jCommander.usage(); exit(EXIT_ERROR); } return this; }  Arguments parse(String[] args); @Override Iterator<URL> getSource(); @Override File getTargetDirectory(); @Override String getTargetPackage(); @Override boolean isGenerateBuilders(); @Override boolean isIncludeTypeInfo(); String getLogLevel(); @Override boolean isUseInnerClassBuilders(); @Override boolean isIncludeConstructorPropertiesAnnotation(); @Override boolean isUsePrimitives(); @Override char[] getPropertyWordDelimiters(); @Override boolean isUseLongIntegers(); @Override boolean isUseDoubleNumbers(); @Override boolean isIncludeHashcodeAndEquals(); @Override boolean isIncludeToString(); @Override String[] getToStringExcludes(); @Override AnnotationStyle getAnnotationStyle(); @Override boolean isUseTitleAsClassname(); @Override InclusionLevel getInclusionLevel(); @Override Class<? extends Annotator> getCustomAnnotator(); @Override Class<? extends RuleFactory> getCustomRuleFactory(); @Override boolean isIncludeJsr303Annotations(); @Override boolean isIncludeJsr305Annotations(); @Override boolean isUseOptionalForGetters(); @Override SourceType getSourceType(); @Override boolean isRemoveOldOutput(); @Override String getOutputEncoding(); @Override boolean isUseJodaDates(); @Override boolean isUseJodaLocalDates(); @Override boolean isUseJodaLocalTimes(); boolean isUseCommonsLang3(); @Override boolean isParcelable(); @Override boolean isSerializable(); @Override FileFilter getFileFilter(); @Override boolean isInitializeCollections(); @Override String getClassNamePrefix(); @Override String getClassNameSuffix(); @Override String[] getFileExtensions(); @Override boolean isIncludeConstructors(); @Override boolean isConstructorsRequiredPropertiesOnly(); boolean isPrintLogLevels(); @Override boolean isIncludeRequiredPropertiesConstructor(); @Override boolean isIncludeAllPropertiesConstructor(); @Override boolean isIncludeCopyConstructor(); @Override boolean isIncludeAdditionalProperties(); @Override boolean isIncludeGetters(); @Override boolean isIncludeSetters(); @Override String getTargetVersion(); @Override boolean isIncludeDynamicAccessors(); @Override boolean isIncludeDynamicGetters(); @Override boolean isIncludeDynamicSetters(); @Override boolean isIncludeDynamicBuilders(); @Override String getDateTimeType(); @Override String getDateType(); @Override String getTimeType(); @Override boolean isUseBigIntegers(); @Override boolean isUseBigDecimals(); @Override boolean isFormatDateTimes(); @Override boolean isFormatDates(); @Override boolean isFormatTimes(); @Override String getRefFragmentPathDelimiters(); @Override String getCustomDatePattern(); @Override String getCustomTimePattern(); @Override String getCustomDateTimePattern(); @Override SourceSortOrder getSourceSortOrder(); @Override Language getTargetLanguage(); @Override Map<String, String> getFormatTypeMapping(); @Parameter(names = { "-dg", "--disable-getters" }, description = "Whether to omit getter methods and create fields instead.")
    private boolean disableGetters; @Parameter(names = { "-ds", "--disable-setters" }, description = "Whether to omit setter methods and create fields instead.")
    private boolean disableSetters; }