@Override public T get() { checkState(isSet(), "value not set"); return payload; }
public static <T> NonNullableField<T> unset() { return new NonNullableField<>(null); }
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 Builder forApplications(Path first, Path... theRest) { checkUnset(applications, "applications"); ImmutableList<Path> paths = ImmutableList.<Path>builder().add(first).add(theRest).build(); this.applications = NonNullableField.<List<Path>>of(paths); return this; }
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 Builder withSourceCodeRoot(Path sourceCodeRoot) { checkUnset(this.sourceCodeRoot, "source code root"); this.sourceCodeRoot = NonNullableField.of(sourceCodeRoot); return this; }
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 Builder withClassLoader(ClassLoader classLoader) { checkUnset(this.classLoader, "class loader"); this.classLoader = NonNullableField.of(classLoader); return this; }
@Override public T get() { checkState(isSet(), "value not set"); return payload; }
public static <T> NonNullableField<T> unset() { return new NonNullableField<>(null); }
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 Builder withClassLoader(ClassLoader classLoader) { checkUnset(this.classLoader, "class loader"); this.classLoader = NonNullableField.of(classLoader); return this; }
@Override public T get() { checkState(isSet(), "value not set"); return payload; }
public static <T> NonNullableField<T> unset() { return new NonNullableField<>(null); }
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); }
public Builder withClassLoader(ClassLoader classLoader) { checkUnset(this.classLoader, "class loader"); this.classLoader = NonNullableField.of(classLoader); return this; }
public static <T> NonNullableField<T> of(T value) { checkNotNull(value); return new NonNullableField<>(value); }