Last active
January 13, 2017 17:58
-
-
Save hisaichi5518/07d939eb642f188fcc8bc3a9b9febbbb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Observable.just("[email protected]").flatMap(new Function<String, ObservableSource<String>>() { | |
@Override | |
public ObservableSource<String> apply(String s) throws Exception { | |
// return Observable.concat(validateEmail(s), validateNonNull(s)); | |
return Observable.zip(validateEmail(s), validateNonNull(s), new BiFunction<String, String, String>() { | |
@Override | |
public String apply(String s, String s2) throws Exception { | |
return s; | |
} | |
}); | |
} | |
}).subscribe(new Observer<String>() { | |
@Override | |
public void onSubscribe(Disposable d) { | |
} | |
@Override | |
public void onNext(String s) { | |
} | |
@Override | |
public void onError(Throwable e) { | |
} | |
@Override | |
public void onComplete() { | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Observable.just(emailView, passwordView).flatMap(new Function<TextView, ObservableSource<DataValidator>>() { | |
@Override | |
public ObservableSource<DataValidator> apply(TextView textView) throws Exception { | |
List<DataValidator> list = Arrays.asList(new DataValidator(), new DataValidator()); // TODO: ViewからValidatorを取得 | |
return Observable.fromIterable(list); | |
} | |
}).flatMap(new Function<DataValidator, ObservableSource<ValidateResult>>() { | |
@Override | |
public ObservableSource<ValidateResult> apply(DataValidator dataValidator) throws Exception { | |
return Observable.just(dataValidator.validate()); | |
} | |
}).subscribe(new Observer<ValidateResult>() { | |
@Override | |
public void onSubscribe(Disposable d) { | |
} | |
@Override | |
public void onNext(ValidateResult validateResult) { | |
} | |
@Override | |
public void onError(Throwable e) { | |
} | |
@Override | |
public void onComplete() { | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Observable.just(emailView, passwordView).flatMap(new Function<TextView, ObservableSource<DataValidator>>() { | |
@Override | |
public ObservableSource<DataValidator> apply(TextView textView) throws Exception { | |
List<DataValidator> list = Arrays.asList(new DataValidator(), new DataValidator()); // TODO: ViewからValidatorを取得 | |
return Observable.fromIterable(list); | |
} | |
}).flatMap(new Function<DataValidator, ObservableSource<ValidateResult>>() { | |
@Override | |
public ObservableSource<ValidateResult> apply(DataValidator dataValidator) throws Exception { | |
return dataValidator.validate(); | |
} | |
}).subscribe(new Observer<ValidateResult>() { | |
@Override | |
public void onSubscribe(Disposable d) { | |
} | |
@Override | |
public void onNext(ValidateResult validateResult) { | |
} | |
@Override | |
public void onError(Throwable e) { | |
} | |
@Override | |
public void onComplete() { | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment