rx.functions.Func5 Java Examples

The following examples show how to use rx.functions.Func5. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TypeRegistry.java    From glitr with MIT License 6 votes vote down vote up
TypeRegistry(Map<Class, List<Object>> overrides, Map<Class<? extends Annotation>, AnnotationBasedDataFetcherFactory> annotationToDataFetcherFactoryMap, Map<Class<? extends Annotation>,
        DataFetcher> annotationToDataFetcherMap, Map<Class<? extends Annotation>, Func4<Field, Method, Class, Annotation, List<GraphQLArgument>>> annotationToArgumentsProviderMap,
             Map<Class<? extends Annotation>, Func5<TypeRegistry, Field, Method, Class, Annotation, GraphQLOutputType>> annotationToGraphQLOutputTypeMap,
             Map<Class, GraphQLType> javaTypeDeclaredAsScalarMap, Relay relay, boolean explicitRelayNodeScanEnabled) {
    this.overrides = overrides;
    this.annotationToDataFetcherFactoryMap = annotationToDataFetcherFactoryMap;
    this.annotationToDataFetcherMap = annotationToDataFetcherMap;
    this.annotationToArgumentsProviderMap = annotationToArgumentsProviderMap;
    this.annotationToGraphQLOutputTypeMap = annotationToGraphQLOutputTypeMap;
    this.javaTypeDeclaredAsScalarMap = javaTypeDeclaredAsScalarMap;
    this.relay = relay;
    if (relay != null) {
        this.nodeInterface = relay.nodeInterface(this);
        // register Node so we don't inadvertently recreate it later
        this.registry.put(Node.class, this.nodeInterface);
        this.nameRegistry.put(Node.class.getSimpleName(), this.nodeInterface);
    }
    this.explicitRelayNodeScanEnabled = explicitRelayNodeScanEnabled;
}
 
Example #2
Source File: TypeRegistry.java    From glitr with MIT License 6 votes vote down vote up
private GraphQLOutputType getGraphQLOutputTypeFromAnnotationsOnField(Class declaringClass, Method method, GraphQLOutputType graphQLOutputType, String name) {
    Field field = ReflectionUtil.getFieldByName(declaringClass, name);

    if (field != null) {
        Annotation[] fieldAnnotations = field.getDeclaredAnnotations();
        for (Annotation annotation: fieldAnnotations) {
            // custom OutputType
            if (annotationToGraphQLOutputTypeMap.containsKey(annotation.annotationType())) {
                Func5<TypeRegistry, Field, Method, Class, Annotation, GraphQLOutputType> customGraphQLOutputTypeFunc = annotationToGraphQLOutputTypeMap.get(annotation.annotationType());
                GraphQLOutputType outputType = customGraphQLOutputTypeFunc.call(this, field, method, declaringClass, annotation);
                if (outputType != null) {
                    graphQLOutputType = outputType;
                    break;
                }
            }
        }
    }
    return graphQLOutputType;
}
 
Example #3
Source File: TypeRegistry.java    From glitr with MIT License 6 votes vote down vote up
private GraphQLOutputType getGraphQLOutputTypeFromAnnotationsOnGetter(Class declaringClass, Method method) {
    GraphQLOutputType graphQLOutputType = null;
    Annotation[] methodAnnotations = method.getDeclaredAnnotations();
    for (Annotation annotation: methodAnnotations) {
        // custom OutputType
        if (annotationToGraphQLOutputTypeMap.containsKey(annotation.annotationType())) {
            Func5<TypeRegistry, Field, Method, Class, Annotation, GraphQLOutputType> customGraphQLOutputTypeFunc = annotationToGraphQLOutputTypeMap.get(annotation.annotationType());
            GraphQLOutputType outputType = customGraphQLOutputTypeFunc.call(this, null, method, declaringClass, annotation);
            if (outputType != null) {
                graphQLOutputType = outputType;
                break;
            }
        }
    }
    return graphQLOutputType;
}
 
Example #4
Source File: RxUtils.java    From RxBinding with Apache License 2.0 6 votes vote down vote up
public static <T1, T2, T3, T4, T5, R> Observable<R> toObservable(
    final Func5<T1, T2, T3, T4, T5, R> func,
    final T1 arg1, final T2 arg2, final T3 arg3, final T4 arg4, final T5 arg5) {
  return Observable.create(new Observable.OnSubscribe<R>() {
    @Override
    public void call(Subscriber<? super R> subscriber) {
      try {
        final R result = func.call(arg1, arg2, arg3, arg4, arg5);
        onNextIfSubscribed(subscriber, result);
        onCompletedIfSubsribed(subscriber);
      } catch (Exception e) {
        onErrorIfSubscribed(subscriber, e);
      }
    }
  });
}
 
Example #5
Source File: Observable.java    From letv with Apache License 2.0 4 votes vote down vote up
public static <T1, T2, T3, T4, T5, R> Observable<R> combineLatest(Observable<? extends T1> o1, Observable<? extends T2> o2, Observable<? extends T3> o3, Observable<? extends T4> o4, Observable<? extends T5> o5, Func5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> combineFunction) {
    return combineLatest(Arrays.asList(new Observable[]{o1, o2, o3, o4, o5}), Functions.fromFunc(combineFunction));
}
 
Example #6
Source File: Observable.java    From letv with Apache License 2.0 4 votes vote down vote up
public static <T1, T2, T3, T4, T5, R> Observable<R> zip(Observable<? extends T1> o1, Observable<? extends T2> o2, Observable<? extends T3> o3, Observable<? extends T4> o4, Observable<? extends T5> o5, Func5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> zipFunction) {
    return just(new Observable[]{o1, o2, o3, o4, o5}).lift(new OperatorZip(zipFunction));
}
 
Example #7
Source File: RxHelper.java    From sfs with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public static final <T1, T2, T3, T4, T5, R> Observable<R> combineSinglesDelayError(Observable<? extends T1> o1, Observable<? extends T2> o2, Observable<? extends T3> o3, Observable<? extends T4> o4, Observable<? extends T5> o5,
                                                                                   Func5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> combineFunction) {
    return combineSinglesDelayError(asList(o1.single(), o2.single(), o3.single(), o4.single(), o5.single()), fromFunc(combineFunction));
}
 
Example #8
Source File: GlitrBuilder.java    From glitr with MIT License 4 votes vote down vote up
public GlitrBuilder withAnnotationToGraphQLOutputTypeMap(Map<Class<? extends Annotation>, Func5<TypeRegistry, Field, Method, Class, Annotation, GraphQLOutputType>> annotationToGraphQLOutputTypeMap) {
    this.annotationToGraphQLOutputTypeMap = annotationToGraphQLOutputTypeMap;
    return this;
}
 
Example #9
Source File: GlitrBuilder.java    From glitr with MIT License 4 votes vote down vote up
public GlitrBuilder addCustomFieldOutputTypeFunc(Class<? extends Annotation> annotationClass, Func5<TypeRegistry, Field, Method, Class, Annotation, GraphQLOutputType> argumentsFunc5) {
    annotationToGraphQLOutputTypeMap.putIfAbsent(annotationClass, argumentsFunc5);
    return this;
}
 
Example #10
Source File: TypeRegistryBuilder.java    From glitr with MIT License 4 votes vote down vote up
public TypeRegistryBuilder withAnnotationToGraphQLOutputTypeMap(Map<Class<? extends Annotation>, Func5<TypeRegistry, Field, Method, Class, Annotation, GraphQLOutputType>> annotationToGraphQLOutputTypeMap) {
    this.annotationToGraphQLOutputTypeMap = annotationToGraphQLOutputTypeMap;
    return this;
}
 
Example #11
Source File: TypeRegistryBuilder.java    From glitr with MIT License 4 votes vote down vote up
public TypeRegistryBuilder addCustomFieldOutputTypeFunc(Class<? extends Annotation> annotationClass, Func5<TypeRegistry, Field, Method, Class, Annotation, GraphQLOutputType> argumentsFunc5) {
    annotationToGraphQLOutputTypeMap.putIfAbsent(annotationClass, argumentsFunc5);
    return this;
}