/** @since 18.0 */ // @Override on JDK8 public <A extends Annotation> A[] getDeclaredAnnotationsByType(Class<A> annotationType) { return FluentIterable.from(annotations).filter(annotationType).toArray(annotationType); }
/** @since 18.0 */ // @Override on JDK8 public <A extends Annotation> A[] getDeclaredAnnotationsByType(Class<A> annotationType) { return FluentIterable.from(annotations).filter(annotationType).toArray(annotationType); }
/** @since 18.0 */ // @Override on JDK8 public <A extends Annotation> A[] getDeclaredAnnotationsByType(Class<A> annotationType) { return FluentIterable.from(annotations).filter(annotationType).toArray(annotationType); }
public ResponseHandler[] toResponseHandlers() { return from(collection).transform(toResponseHandler()).toArray(ResponseHandler.class); }
@Override protected Optional<String[]> doExtract(final HttpRequest request) { String[] extractedValues = from(request.getHeaders().entrySet()) .filter(isForHeaderName(name)) .transform(toValue()) .transformAndConcat(arrayAsIterable()) .toArray(String.class); if (extractedValues.length > 0) { return of(extractedValues); } return absent(); }
private static MeasureComputerDefinition validateDef(MeasureComputerDefinition def) { if (def instanceof MeasureComputerDefinitionImpl) { return def; } // If the computer has not been created by the builder, we recreate it to make sure it's valid Set<String> inputMetrics = def.getInputMetrics(); Set<String> outputMetrics = def.getOutputMetrics(); return new MeasureComputerDefinitionImpl.BuilderImpl() .setInputMetrics(from(inputMetrics).toArray(String.class)) .setOutputMetrics(from(outputMetrics).toArray(String.class)) .build(); } }
private static MeasureRepoEntry[] concatIntoArray(MeasureRepoEntry[] otherMeasures, MeasureRepoEntry... measureRepoEntries) { return from(concat( asList(otherMeasures), from(asList(measureRepoEntries)).filter(notNull()))) .toArray(MeasureRepoEntry.class); }
private static MeasureRepoEntry[] concatIntoArray(MeasureRepoEntry[] otherMeasures, MeasureRepoEntry... measureRepoEntries) { return from(concat( asList(otherMeasures), from(asList(measureRepoEntries)).filter(notNull()))) .toArray(MeasureRepoEntry.class); }
private static Object[][] dataproviderFromComponentTypeValues(Predicate<Component.Type> predicate) { return FluentIterable.from(asList(Component.Type.values())) .filter(predicate) .transform(WrapInSingleElementArray.INSTANCE) .toArray(Object[].class); }
private static Object[][] getMeasuresExcept(final ValueType valueType) { return from(MEASURES) .filter(input -> input.getValueType() != valueType).transform(WrapInSingleElementArray.INSTANCE) .toArray(Object[].class); }
@DataProvider public static Object[][] measures() { return from(MEASURES).transform(new Function<Measure, Object[]>() { @Nullable @Override public Object[] apply(Measure input) { return new Measure[] {input}; } }).toArray(Object[].class); }
@DataProvider public static Object[][] viewsTypes() { return from(VIEWS_TYPES).transform(new Function<Type, Object[]>() { @Nullable @Override public Object[] apply(Type input) { return new Object[] {input}; } }).toArray(Object[].class); }
@DataProvider public static Object[][] reportTypes() { return from(REPORT_TYPES).transform(new Function<Type, Object[]>() { @Nullable @Override public Object[] apply(Type input) { return new Object[] {input}; } }).toArray(Object[].class); } }
@DataProvider public static Object[][] all() { return from(MEASURES).transform(WrapInSingleElementArray.INSTANCE).toArray(Object[].class); }
@DataProvider public static Object[][] allComponentTypesButFile() { return from(Arrays.asList(Component.Type.values())) .filter(not(equalTo(Component.Type.FILE))) .transform(WrapInSingleElementArray.INSTANCE) .toArray(Object[].class); }
return new Component[] {input}; }).toArray(Component[].class);
public static FormatterAndType[] getFormatterAndType(List<String> formats){ if(formats == null || formats.isEmpty()){ return DEFAULT_FORMATTERS; } return FluentIterable.from(formats).transform(new Function<String, FormatterAndType>(){ @Override public FormatterAndType apply(String input) { return getFormatterAndType(input); }}).toArray(FormatterAndType.class); }
@Override public Object get(final BindingProvider provider) { try{ return constructor.newInstance(FluentIterable.from(providers).transform(new Function<FinalResolver, Object>(){ @Override public Object apply(FinalResolver input) { return input.getImplementation(provider); }}).toArray(Object.class)); }catch(Exception ex){ throw new RuntimeException(String.format("Failure while attempting to create %s.", clazz.getName()), ex); } }
private static String[] s(byte[]... values){ return FluentIterable.of(values).transform(new Function<byte[], String>(){ @Override public String apply(byte[] input) { if(input == null){ return null; } return new String(input, Charsets.UTF_8); }}).toArray(String.class); }
private FieldAnnotation(ElasticAnnotation annotation) { super(); this.path = SchemaPath.getCompoundPath(FluentIterable.from(annotation.getPathList()).toArray(String.class)); this.analyzed = annotation.hasAnalyzed() && annotation.getAnalyzed(); this.notIndexed = annotation.hasNotIndexed() && annotation.getNotIndexed(); this.normalized = annotation.hasNormalized() && annotation.getNormalized(); this.docValueMissing = annotation.hasDocValueMissing() && annotation.getDocValueMissing(); this.dateFormats = annotation.getDateFormatsList(); this.specialType = annotation.hasSpecialType() ? annotation.getSpecialType() : null; }