rx.functions.Func4 Java Examples

The following examples show how to use rx.functions.Func4. 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: RxUtils.java    From RxBinding with Apache License 2.0 6 votes vote down vote up
public static <T1, T2, T3, T4, R> Observable<R> toObservable(
    final Func4<T1, T2, T3, T4, R> func,
    final T1 arg1, final T2 arg2, final T3 arg3, final T4 arg4) {
  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);
        onNextIfSubscribed(subscriber, result);
        onCompletedIfSubsribed(subscriber);
      } catch (Exception e) {
        onErrorIfSubscribed(subscriber, e);
      }
    }
  });
}
 
Example #3
Source File: RxPresenter.java    From FlowGeek with GNU General Public License v2.0 5 votes vote down vote up
public <T, T1, T2, T3, T4> void restartableFirst(int restartableId,
                                                 final Func4<T1, T2, T3, T4, Observable<T>> observableFactory,
                                                 final Action2<View, T> onNext,
                                                 @Nullable final Action2<View, Throwable> onError) {

    restartable(restartableId, new Func4<T1, T2, T3, T4, Subscription>() {
        @Override
        public Subscription call(T1 arg1, T2 arg2, T3 arg3, T4 arg4) {
            return observableFactory.call(arg1, arg2, arg3, arg4)
                    .compose(RxPresenter.this.<T>deliverFirst())
                    .subscribe(split(onNext, onError));
        }
    });
}
 
Example #4
Source File: TypeRegistry.java    From glitr with MIT License 5 votes vote down vote up
private List<GraphQLArgument> getGraphQLArgumentsFromAnnotations(Field field, Method method, Class declaringClass, Annotation[] annotations) {
    List<GraphQLArgument> argumentList = new ArrayList<>();
    for (Annotation annotation : annotations) {
        // custom arguments
        if (annotationToArgumentsProviderMap.containsKey(annotation.annotationType())) {
            Func4<Field, Method, Class, Annotation, List<GraphQLArgument>> customArgumentsFunc = annotationToArgumentsProviderMap.get(annotation.annotationType());
            argumentList = customArgumentsFunc.call(field, method, declaringClass, annotation);
        }
    }
    return argumentList;
}
 
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, R> Observable<R> combineLatest(Observable<? extends T1> o1, Observable<? extends T2> o2, Observable<? extends T3> o3, Observable<? extends T4> o4, Func4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> combineFunction) {
    return combineLatest(Arrays.asList(new Observable[]{o1, o2, o3, o4}), 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, R> Observable<R> zip(Observable<? extends T1> o1, Observable<? extends T2> o2, Observable<? extends T3> o3, Observable<? extends T4> o4, Func4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> zipFunction) {
    return just(new Observable[]{o1, o2, o3, o4}).lift(new OperatorZip(zipFunction));
}
 
Example #7
Source File: RxPresenter.java    From FlowGeek with GNU General Public License v2.0 4 votes vote down vote up
public <T1, T2, T3, T4> void restartable(int restartableId, Func4<T1, T2, T3, T4, Subscription> factory) {
    if (workingSubscribers.containsKey(restartableId)) {
        stop(restartableId);
    }
    restartables4.put(restartableId, factory);
}
 
Example #8
Source File: RxPresenter.java    From FlowGeek with GNU General Public License v2.0 4 votes vote down vote up
public <T1, T2, T3, T4> void start(int restartableId, T1 arg1, T2 arg2, T3 arg3, T4 arg4) {
    stop(restartableId);
    Func4<T1, T2, T3, T4, Subscription> func4 = (Func4<T1, T2, T3, T4, Subscription>) restartables4.get(restartableId);
    if (func4 != null)
        workingSubscribers.put(restartableId, func4.call(arg1, arg2, arg3, arg4));
}
 
Example #9
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, R> Observable<R> combineSinglesDelayError(Observable<? extends T1> o1, Observable<? extends T2> o2, Observable<? extends T3> o3, Observable<? extends T4> o4,
                                                                               Func4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> combineFunction) {
    return combineSinglesDelayError(asList(o1.single(), o2.single(), o3.single(), o4.single()), fromFunc(combineFunction));
}
 
Example #10
Source File: GlitrBuilder.java    From glitr with MIT License 4 votes vote down vote up
public GlitrBuilder withAnnotationToArgumentsProviderMap(Map<Class<? extends Annotation>, Func4<Field, Method, Class, Annotation, List<GraphQLArgument>>> annotationToArgumentsProviderMap) {
    this.annotationToArgumentsProviderMap = annotationToArgumentsProviderMap;
    return this;
}
 
Example #11
Source File: GlitrBuilder.java    From glitr with MIT License 4 votes vote down vote up
public GlitrBuilder addCustomFieldArgumentsFunc(Class<? extends Annotation> annotationClass, Func4<Field, Method, Class, Annotation, List<GraphQLArgument>> argumentsFunc4) {
    annotationToArgumentsProviderMap.putIfAbsent(annotationClass, argumentsFunc4);
    return this;
}
 
Example #12
Source File: TypeRegistryBuilder.java    From glitr with MIT License 4 votes vote down vote up
public TypeRegistryBuilder withAnnotationToArgumentsProviderMap(Map<Class<? extends Annotation>, Func4<Field, Method, Class, Annotation, List<GraphQLArgument>>> annotationToArgumentsProviderMap) {
    this.annotationToArgumentsProviderMap = annotationToArgumentsProviderMap;
    return this;
}
 
Example #13
Source File: TypeRegistryBuilder.java    From glitr with MIT License 4 votes vote down vote up
public TypeRegistryBuilder addCustomFieldArgumentsFunc(Class<? extends Annotation> annotationClass, Func4<Field, Method, Class, Annotation, List<GraphQLArgument>> argumentsFunc4) {
    annotationToArgumentsProviderMap.putIfAbsent(annotationClass, argumentsFunc4);
    return this;
}