本文整理汇总了Java中rx.functions.Func1类的典型用法代码示例。如果您正苦于以下问题:Java Func1类的具体用法?Java Func1怎么用?Java Func1使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Func1类属于rx.functions包,在下文中一共展示了Func1类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: beginPutAsyncNoRetrySucceededWithServiceResponseAsync
import rx.functions.Func1; //导入依赖的package包/类
/**
* Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status.
*
* @param product Product to put
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the Product object
*/
public Observable<ServiceResponseWithHeaders<Product, LROsPutAsyncNoRetrySucceededHeaders>> beginPutAsyncNoRetrySucceededWithServiceResponseAsync(Product product) {
Validator.validate(product);
return service.beginPutAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Product, LROsPutAsyncNoRetrySucceededHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Product, LROsPutAsyncNoRetrySucceededHeaders>> call(Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<Product, LROsPutAsyncNoRetrySucceededHeaders> clientResponse = beginPutAsyncNoRetrySucceededDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
示例2: getNullWithServiceResponseAsync
import rx.functions.Func1; //导入依赖的package包/类
/**
* Get null datetime value.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the DateTime object
*/
public Observable<ServiceResponse<DateTime>> getNullWithServiceResponseAsync() {
return service.getNull()
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<DateTime>>>() {
@Override
public Observable<ServiceResponse<DateTime>> call(Response<ResponseBody> response) {
try {
ServiceResponse<DateTimeRfc1123> result = getNullDelegate(response);
DateTime body = null;
if (result.body() != null) {
body = result.body().dateTime();
}
ServiceResponse<DateTime> clientResponse = new ServiceResponse<DateTime>(body, result.response());
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
示例3: login_usepwd
import rx.functions.Func1; //导入依赖的package包/类
/**
* 用密码登录的接口
*/
public void login_usepwd(HttpResultListener<Boolean> subscriber, final String tel, final String code) {
mApi.login_usepwd(tel, code)
.map(new HttpResultFuncNoList_has_obj())
.map(new Func1<Obj, Boolean>() {
@Override
public Boolean call(Obj o) {
if (o != null) {
Shared.saveUserInfo(o);
//Log.i("lin", "----" + o.getIsReal());
Log.i("lin", "=====lin=====> 保存的用户姓名 3333" + o.getName());
return true;
} else {
return false;
}
}
})
.subscribeOn(Schedulers.io())//在工作线程请求网络
.observeOn(AndroidSchedulers.mainThread())//在主线程处理结果
.subscribe(new HttpResultSubscriber<>(subscriber));
}
示例4: listStorageContainersNextSinglePageAsync
import rx.functions.Func1; //导入依赖的package包/类
/**
* Lists the Azure Storage containers, if any, associated with the specified Data Lake Analytics and Azure Storage account combination. The response includes a link to the next page of results, if any.
*
ServiceResponse<PageImpl<StorageContainer>> * @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<StorageContainer> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<StorageContainer>>> listStorageContainersNextSinglePageAsync(final String nextPageLink) {
if (nextPageLink == null) {
throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
}
String nextUrl = String.format("%s", nextPageLink);
return service.listStorageContainersNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<StorageContainer>>>>() {
@Override
public Observable<ServiceResponse<Page<StorageContainer>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<StorageContainer>> result = listStorageContainersNextDelegate(response);
return Observable.just(new ServiceResponse<Page<StorageContainer>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
示例5: validateMoveWithServiceResponseAsync
import rx.functions.Func1; //导入依赖的package包/类
/**
* Validate whether a resource can be moved.
* Validate whether a resource can be moved.
*
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param moveResourceEnvelope Object that represents the resource to move.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<ServiceResponse<Void>> validateMoveWithServiceResponseAsync(String resourceGroupName, CsmMoveResourceEnvelopeInner moveResourceEnvelope) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (this.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null.");
}
if (moveResourceEnvelope == null) {
throw new IllegalArgumentException("Parameter moveResourceEnvelope is required and cannot be null.");
}
Validator.validate(moveResourceEnvelope);
final String apiVersion = "2016-03-01";
return service.validateMove(resourceGroupName, this.subscriptionId(), moveResourceEnvelope, apiVersion, this.acceptLanguage(), this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = validateMoveDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
示例6: toPagedList
import rx.functions.Func1; //导入依赖的package包/类
/**
* Converts the given list of a type to paged list of a different type.
*
* @param list the list to convert to paged list
* @param mapper the mapper to map type in input list to output list
* @param <OutT> the type of items in output paged list
* @param <InT> the type of items in input paged list
* @return the paged list
*/
public static <OutT, InT> PagedList<OutT> toPagedList(List<InT> list, final Func1<InT, OutT> mapper) {
PageImpl<InT> page = new PageImpl<>();
page.setItems(list);
page.setNextPageLink(null);
PagedList<InT> pagedList = new PagedList<InT>(page) {
@Override
public Page<InT> nextPage(String nextPageLink) {
return null;
}
};
PagedListConverter<InT, OutT> converter = new PagedListConverter<InT, OutT>() {
@Override
public Observable<OutT> typeConvertAsync(InT inner) {
return Observable.just(mapper.call(inner));
}
};
return converter.convert(pagedList);
}
示例7: toast
import rx.functions.Func1; //导入依赖的package包/类
public static void toast(int resId) {
Observable.just(resId)
.subscribeOn(Schedulers.io())
.map(new Func1<Integer, String>() {
@Override
public String call(Integer integer) {
return App.context.getResources().getString(integer);
}
})
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<String>() {
@Override
public void call(String s) {
try {
if (mToast != null) {
mToast.cancel();
}
} catch (Exception e) {
e.printStackTrace();
}
mToast = Toast.makeText(App.context, s, Toast.LENGTH_SHORT);
mToast.setGravity(Gravity.CENTER, 0, 0);
mToast.show();
}
});
}
示例8: listSinglePageAsync
import rx.functions.Func1; //导入依赖的package包/类
/**
* Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later.
*
ServiceResponse<PageImpl<UsageDetailInner>> * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing perdiod.
ServiceResponse<PageImpl<UsageDetailInner>> * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details.
ServiceResponse<PageImpl<UsageDetailInner>> * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'.
ServiceResponse<PageImpl<UsageDetailInner>> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls.
ServiceResponse<PageImpl<UsageDetailInner>> * @param top May be used to limit the number of results to the most recent N usageDetails.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<UsageDetailInner>>> listSinglePageAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) {
if (scope == null) {
throw new IllegalArgumentException("Parameter scope is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.list(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<UsageDetailInner>>>>() {
@Override
public Observable<ServiceResponse<Page<UsageDetailInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<UsageDetailInner>> result = listDelegate(response);
return Observable.just(new ServiceResponse<Page<UsageDetailInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
示例9: listSinglePageAsync
import rx.functions.Func1; //导入依赖的package包/类
/**
* Provides the list of records from the activity logs.
*
ServiceResponse<PageImpl1<EventDataInner>> * @param filter Reduces the set of data collected.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed.
ServiceResponse<PageImpl1<EventDataInner>> * @param select Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<EventDataInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<EventDataInner>>> listSinglePageAsync(final String filter, final String select) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2015-04-01";
return service.list(this.client.subscriptionId(), apiVersion, filter, select, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<EventDataInner>>>>() {
@Override
public Observable<ServiceResponse<Page<EventDataInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl1<EventDataInner>> result = listDelegate(response);
return Observable.just(new ServiceResponse<Page<EventDataInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
示例10: doubleDecimalNegativeWithServiceResponseAsync
import rx.functions.Func1; //导入依赖的package包/类
/**
* Get '-9999999.999' numeric value.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<ServiceResponse<Void>> doubleDecimalNegativeWithServiceResponseAsync() {
final double doubleQuery = -9999999.999;
return service.doubleDecimalNegative(doubleQuery)
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = doubleDecimalNegativeDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
示例11: listMetricDefinitionsSlotNextSinglePageAsync
import rx.functions.Func1; //导入依赖的package包/类
/**
* Gets all metric definitions of an app (or deployment slot, if specified).
* Gets all metric definitions of an app (or deployment slot, if specified).
*
ServiceResponse<PageImpl<ResourceMetricDefinitionInner>> * @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<ResourceMetricDefinitionInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> listMetricDefinitionsSlotNextSinglePageAsync(final String nextPageLink) {
if (nextPageLink == null) {
throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
}
String nextUrl = String.format("%s", nextPageLink);
return service.listMetricDefinitionsSlotNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<ResourceMetricDefinitionInner>> result = listMetricDefinitionsSlotNextDelegate(response);
return Observable.just(new ServiceResponse<Page<ResourceMetricDefinitionInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
示例12: listSinglePageAsync
import rx.functions.Func1; //导入依赖的package包/类
/**
* Lists all of the available Azure Container Registry REST API operations.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<OperationDefinitionInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<OperationDefinitionInner>>> listSinglePageAsync() {
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<OperationDefinitionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<OperationDefinitionInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<OperationDefinitionInner>> result = listDelegate(response);
return Observable.just(new ServiceResponse<Page<OperationDefinitionInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
示例13: doubleDecimalPositiveWithServiceResponseAsync
import rx.functions.Func1; //导入依赖的package包/类
/**
* Get '9999999.999' numeric value.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<ServiceResponse<Void>> doubleDecimalPositiveWithServiceResponseAsync() {
final double doubleQuery = 9999999.999;
return service.doubleDecimalPositive(doubleQuery)
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = doubleDecimalPositiveDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
示例14: dateTimeValidWithServiceResponseAsync
import rx.functions.Func1; //导入依赖的package包/类
/**
* Get '2012-01-01T01:01:01Z' as date-time.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<ServiceResponse<Void>> dateTimeValidWithServiceResponseAsync() {
final DateTime dateTimePath = DateTime.parse("2012-01-01T01:01:01Z");
return service.dateTimeValid(dateTimePath)
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = dateTimeValidDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
示例15: beginStartWithServiceResponseAsync
import rx.functions.Func1; //导入依赖的package包/类
/**
* Starts a streaming job. Once a job is started it will start processing input events and produce output.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
* @param jobName The name of the streaming job.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<ServiceResponse<Void>> beginStartWithServiceResponseAsync(String resourceGroupName, String jobName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (jobName == null) {
throw new IllegalArgumentException("Parameter jobName is required and cannot be null.");
}
final String apiVersion = "2016-03-01";
final StartStreamingJobParametersInner startJobParameters = null;
return service.beginStart(this.client.subscriptionId(), resourceGroupName, jobName, startJobParameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = beginStartDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}