public OneStopShop build() { checkSet(this.jaxRsClassesRoot, "classes root"); checkSet(this.ramlOutputFile, "raml output file"); checkSet(this.ramlConfiguration, "raml configuration"); Path classesRoot = jaxRsClassesRoot.get(); checkArgument(Files.isDirectory(classesRoot), "classes root %s is not a valid directory", classesRoot); if (sourceCodeRoot.isSet()) { Path path = sourceCodeRoot.get(); checkArgument(Files.isDirectory(path), "source code root %s is not a valid directory", path); } return OneStopShop.create(classesRoot, this.ramlOutputFile.get(), this.sourceCodeRoot, this.ramlConfiguration.get()); }
public JerseyGatherer build() { checkSet(applications, "applications"); ResourceConfig resourceConfig = new ResourceConfig(); resourceConfig.files(true, FluentIterable.from(this.applications.get()).transform(new Function<Path, String>() { @Nullable @Override public String apply(@Nullable Path path) { return path.toString(); } }).toArray(String.class)); if (classLoader.isSet()) { resourceConfig.setClassLoader(classLoader.get()); } return create(resourceConfig); }
public JerseyGatherer build() { checkSet(applications, "applications"); ResourceConfig resourceConfig = new ResourceConfig(); resourceConfig.files(true, FluentIterable.from(this.applications.get()).transform(new Function<Path, String>() { @Nullable @Override public String apply(@Nullable Path path) { return path.toString(); } }).toArray(String.class)); if (classLoader.isSet()) { resourceConfig.setClassLoader(classLoader.get()); } return create(resourceConfig); }
public JerseyGatherer build() { checkSet(applications, "applications"); ResourceConfig resourceConfig = new ResourceConfig(); resourceConfig.files(true, FluentIterable.from(this.applications.get()).transform(new Function<Path, String>() { @Nullable @Override public String apply(@Nullable Path path) { return path.toString(); } }).toArray(String.class)); if (classLoader.isSet()) { resourceConfig.setClassLoader(classLoader.get()); } return create(resourceConfig); }
public void parseJaxRsAndOutputRaml() throws JaxRsToRamlConversionException, JaxRsParsingException, RamlEmissionException { SourceParser sourceParser = sourceCodeRoot.isSet() ? SourceParsers.usingRoasterParser(sourceCodeRoot.get()) : SourceParsers.nullParser(); JaxRsApplication application = JaxRsParsers.usingJerseyWith(jaxRsUrl, sourceParser, ramlConfiguration.getTranslatedAnnotations()).parse(); RamlApi ramlApi = JaxRsToRamlConverter.create().convert(ramlConfiguration, application); Emitter emitter = FileEmitter.forFile(ramlOutputFile); emitter.emit(ramlApi); }