List of usage examples for com.google.common.collect FluentIterable of
@Beta @CheckReturnValue @Deprecated public static <E> FluentIterable<E> of(E[] elements)
From source file:org.raml.jaxrs.cli.Main.java
public static void main(String[] args) throws Exception { Options options = new Options(); options.addOption(Option.builder("a").required().longOpt("applicationDirectory").hasArg() .desc("application path").build()); options.addOption(/*from w w w. ja va 2 s. c om*/ Option.builder("o").required().longOpt("output").hasArg().desc("RAML output file").build()); options.addOption("s", "sourceRoot", true, "JaxRs source root"); options.addOption("t", "translatedAnnotations", true, "translated annotation list (comma separated"); try { CommandLineParser parser = new DefaultParser(); CommandLine command = parser.parse(options, args); Path jaxRsResourceFile = Paths.get(command.getOptionValue('a')); Path ramlOutputFile = Paths.get(command.getOptionValue('o')); Path jaxRsSourceRoot = null; if (command.hasOption('s')) { jaxRsSourceRoot = Paths.get(command.getOptionValue('s')); } RamlConfiguration ramlConfiguration = DefaultRamlConfiguration.forApplication( jaxRsResourceFile.getFileName().toString(), Collections.<Class<? extends Annotation>>emptySet()); OneStopShop.Builder builder = OneStopShop.builder().withJaxRsClassesRoot(jaxRsResourceFile) .withRamlOutputFile(ramlOutputFile).withRamlConfiguration(ramlConfiguration); if (null != jaxRsSourceRoot) { builder.withSourceCodeRoot(jaxRsSourceRoot); } if (command.hasOption('t')) { String[] classes = command.getOptionValue('t').split(","); List<Class<? extends Annotation>> c = FluentIterable.of(classes) .transform(new Function<String, Class<? extends Annotation>>() { @Nullable @Override public Class<? extends Annotation> apply(@Nullable String input) { try { return (Class<? extends Annotation>) Class.forName(input); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("while building translated annotations list", e); } } }).toList(); builder.withTranslatedAnnotations(c); } OneStopShop oneStopShop = builder.build(); oneStopShop.parseJaxRsAndOutputRaml(); } catch (ParseException e) { HelpFormatter formatter = new HelpFormatter(); System.err.println(e.getMessage()); formatter.printHelp("jaxrstoraml", options, true); } }
From source file:org.raml.jaxrs.parser.util.ClassLoaderUtils.java
public static ClassLoader classLoaderFor(URL firstUrl, URL... theRest) { URL[] allOfDem = FluentIterable.of(theRest).append(firstUrl).toArray(URL.class); // In the absence of specific parent, we use the current one as the parent. // Otherwise, some incongruities might happen when running from the maven // plugin for example. return new URLClassLoader(allOfDem, Thread.currentThread().getContextClassLoader()); }
From source file:com.gwtplatform.processors.tools.utils.Primitives.java
public static Optional<Primitives> findByPrimitive(final CharSequence primitiveName) { return FluentIterable.of(values()) .firstMatch(primitives -> primitiveName.equals(primitives.getPrimitive())); }
From source file:com.gwtplatform.processors.tools.utils.Primitives.java
public static Optional<Primitives> findByBoxed(final CharSequence boxedName) { return FluentIterable.of(values()) .firstMatch(primitives -> boxedName.equals(primitives.getBoxedClass().getCanonicalName())); }
From source file:com.facebook.buck.rules.AbstractRelativeCellName.java
public static RelativeCellName fromComponents(String... strings) { return RelativeCellName.of(FluentIterable.of(strings)); }
From source file:be.nbb.demetra.access.JackcessFileFilter.java
public JackcessFileFilter() { this.description = new StringBuilder().append("Access file (") .append(Joiner.on(", ") .join(FluentIterable.of(Database.FileFormat.values()).transform(toFileExt()).toSet())) .append(")").toString(); }
From source file:com.github.tomakehurst.wiremock.matching.StringValuePattern.java
public final String getName() { Constructor<?> constructor = FluentIterable.of(this.getClass().getDeclaredConstructors()) .firstMatch(new Predicate<Constructor<?>>() { @Override/*from www. j a va 2 s .co m*/ public boolean apply(Constructor<?> input) { return (input.getParameterAnnotations().length > 0 && input.getParameterAnnotations()[0].length > 0 && input.getParameterAnnotations()[0][0] instanceof JsonProperty); } }).orNull(); if (constructor == null) { throw new IllegalStateException( "Constructor must have a first parameter annotatated with JsonProperty(\"<operator name>\")"); } JsonProperty jsonPropertyAnnotation = (JsonProperty) constructor.getParameterAnnotations()[0][0]; return jsonPropertyAnnotation.value(); }
From source file:com.pkware.truth.android.preferences.ListPreferenceSubject.java
public ListPreferenceSubject hasEntries(String... entries) { // We convert to Strings b/c most of the time we are interested in the text content String[] actualEntries = FluentIterable.of(actual().getEntries()).transform(mapToString()) .toArray(String.class); assertThat(actualEntries).named("entries").isEqualTo(entries); return this; }
From source file:com.pkware.truth.android.preferences.MultiSelectListPreferenceSubject.java
public MultiSelectListPreferenceSubject hasEntries(String... entries) { // We convert to Strings b/c most of the time we are interested in the text content String[] actualEntries = FluentIterable.of(actual().getEntries()).transform(mapToString()) .toArray(String.class); assertThat(actualEntries).named("entries").isEqualTo(entries); return this; }
From source file:com.arcbees.gwtpolymer.tasks.ComponentFilesCollector.java
private List<String> extractElementNames(File[] files, final File moduleDirectory) { return FluentIterable.of(files).transform(input -> moduleDirectory.getName() + "/" + input.getName()) .toList();/* ww w.j av a2s . c o m*/ }