下面列出了怎么用com.mongodb.rx.client.Success的API类实例代码及写法,或者点击链接到github查看源代码。
@ApiOperation(value="学生创建", notes="根据BaseStudentDTO对象创建学生")
@ApiImplicitParam(name = "student", value = "学生详细实体student", required = true, dataType = "BaseStudentDTO")
@PostMapping(value = "",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE})
public Observable<Success> createStudent(@RequestBody BaseStudentDTO student) {
logger.debug("Creating a new Student.");
return studentRepository.createStudent(student);
}
@ApiOperation(value="学生创建", notes="根据BaseStudentDTO对象创建学生")
@ApiImplicitParam(name = "student", value = "学生详细实体student", required = true, dataType = "BaseStudentDTO")
@PostMapping(value = "",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE})
public Observable<Success> createStudent(@RequestBody BaseStudentDTO student) {
logger.debug("Creating a new Student.");
return studentRepository.createStudent(student);
}
@ApiOperation(value="学生创建", notes="根据BaseStudentDTO对象创建学生")
@ApiImplicitParam(name = "student", value = "学生详细实体student", required = true, dataType = "BaseStudentDTO")
@PostMapping(value = "",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE})
public Observable<Success> createStudent(@RequestBody BaseStudentDTO student) {
logger.debug("Creating a new Student.");
return studentRepository.createStudent(student);
}
@ApiOperation(value="学生创建", notes="根据BaseStudentDTO对象创建学生")
@ApiImplicitParam(name = "student", value = "学生详细实体student", required = true, dataType = "BaseStudentDTO")
@PostMapping(value = "",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE})
public Observable<Success> createStudent(@RequestBody BaseStudentDTO student) {
logger.debug("Creating a new Student.");
return studentRepository.createStudent(student);
}
@Override
public Observable<Success> close() {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.close(voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> abort() {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.abort(voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> insertOne(final TDocument document) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.insertOne(document, voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> insertOne(final TDocument document, final InsertOneOptions options) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.insertOne(document, options, voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> insertMany(final List<? extends TDocument> documents, final InsertManyOptions options) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.insertMany(documents, options, voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> drop() {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.drop(voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> dropIndex(final String indexName) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.dropIndex(indexName, voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> dropIndex(final Bson keys) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.dropIndex(keys, voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> renameCollection(final MongoNamespace newCollectionNamespace, final RenameCollectionOptions options) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.renameCollection(newCollectionNamespace, options, voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> drop() {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.drop(voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> createCollection(final String collectionName, final CreateCollectionOptions options) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.createCollection(collectionName, options, voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> createView(final String viewName, final String viewOn, final List<? extends Bson> pipeline) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.createView(viewName, viewOn, pipeline, voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> createView(final String viewName, final String viewOn, final List<? extends Bson> pipeline,
final CreateViewOptions createViewOptions) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.createView(viewName, viewOn, pipeline, createViewOptions, voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> close() {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.close(voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> toCollection() {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.toCollection(voidToSuccessCallback(callback));
}
}), observableAdapter);
}
/**
* Helper to trigger Boolean SingleResultCallbacks for Void operations
*
* @param callback the boolean single result callback.
* @return the results callback for an operation that returns null to signal success.
*/
public static SingleResultCallback<Void> voidToSuccessCallback(final SingleResultCallback<Success> callback) {
return new SingleResultCallback<Void>() {
@Override
public void onResult(final Void result, final Throwable t) {
callback.onResult(Success.SUCCESS, t);
}
};
}
@Override
public Observable<Success> uploadFromStream(final BsonValue id, final String filename, final AsyncInputStream source) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.uploadFromStream(id, filename, toCallbackAsyncInputStream(source), voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> uploadFromStream(final BsonValue id, final String filename, final AsyncInputStream source,
final GridFSUploadOptions options) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.uploadFromStream(id, filename, toCallbackAsyncInputStream(source), options, voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> delete(final ObjectId id) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.delete(id, voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> delete(final BsonValue id) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.delete(id, voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> rename(final ObjectId id, final String newFilename) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.rename(id, newFilename, voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> rename(final BsonValue id, final String newFilename) {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.rename(id, newFilename, voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> drop() {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.drop(voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> toCollection() {
return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
@Override
public void apply(final SingleResultCallback<Success> callback) {
wrapped.toCollection(voidToSuccessCallback(callback));
}
}), observableAdapter);
}
@Override
public Observable<Success> insertMany(final List<? extends TDocument> documents) {
return insertMany(documents, new InsertManyOptions());
}
@Override
public Observable<Success> dropIndexes() {
return dropIndex("*");
}