当前位置: 首页>>代码示例>>Java>>正文


Java Flux.empty方法代码示例

本文整理汇总了Java中reactor.core.publisher.Flux.empty方法的典型用法代码示例。如果您正苦于以下问题:Java Flux.empty方法的具体用法?Java Flux.empty怎么用?Java Flux.empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在reactor.core.publisher.Flux的用法示例。


在下文中一共展示了Flux.empty方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findAllImages

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
public Flux<Image> findAllImages() {
	try {
		return Flux.fromIterable(
				Files.newDirectoryStream(Paths.get(UPLOAD_ROOT)))
			.map(path ->
				new Image(path.hashCode(),
					path.getFileName().toString()));
	} catch (IOException e) {
		return Flux.empty();
	}
}
 
开发者ID:PacktPublishing,项目名称:Learning-Spring-Boot-2.0-Second-Edition,代码行数:12,代码来源:ImageService.java

示例2: apply

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
protected Flux<?> apply(Flux<?> input) {
	if (this.function != null) {
		return function.apply(input);
	}
	if (this.consumer != null) {
		this.consumer.accept(input);
		return Flux.empty();
	}
	if (this.supplier != null) {
		return this.supplier.get();
	}
	throw new IllegalStateException("No function defined");
}
 
开发者ID:kbastani,项目名称:service-block-samples,代码行数:14,代码来源:SpringFunctionInitializer.java

示例3: getConfigAttributes

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
public Flux<ConfigAttribute> getConfigAttributes(ServerWebExchange exchange) {
	for(Map.Entry<ServerWebExchangeMatcher,SecurityConfig> entry : mappings.entrySet()) {
		if(entry.getKey().matches(exchange).isMatch()) {
			return Flux.just(entry.getValue());
		}
	}
	return Flux.empty();
}
 
开发者ID:guilhebl,项目名称:item-shop-reactive-backend,代码行数:9,代码来源:ServerWebExchangeMetadataSource.java

示例4: convertToFlux

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
private Flux<?> convertToFlux(Object[] params) {
    if (params.length == 0) {
        return Flux.empty();
    }
    Object firstParam = params[0];
    if (firstParam instanceof Collection){
        return Flux.fromIterable((Collection) firstParam);
    }
    return Flux.just(firstParam);
}
 
开发者ID:fnproject,项目名称:fdk-java,代码行数:11,代码来源:SpringCloudFunctionInvoker.java

示例5: emptyFlux

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
Flux<String> emptyFlux() {
    return Flux.empty();
}
 
开发者ID:aliaksei-lithium,项目名称:spring5demo,代码行数:4,代码来源:FluxSampleTest.java

示例6: getEmptyFluxStream

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
@Override
public Flux<Employee> getEmptyFluxStream() {
	Flux<Employee> empListEmpty = Flux.empty();
	return empListEmpty;
}
 
开发者ID:PacktPublishing,项目名称:Spring-5.0-Cookbook,代码行数:6,代码来源:EmployeeStreamServiceImpl.java

示例7: getAccessCertificates

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
@Override
@Transactional
public Flux<SignedAccessCertificateResource> getAccessCertificates(DeviceNonceAuthentication nonceAuthentication) {
    requireNonNull(nonceAuthentication, "`nonceAuthentication` must not be null");

    DeviceEntity device = deviceRepository.findBySerialNumber(nonceAuthentication.getDeviceSerialNumber())
            .orElseThrow(() -> new NotFoundException("DeviceEntity not found"));

    verifyNonceAuthOrThrow(nonceAuthentication, device.getPublicKey());

    List<AccessCertificateEntity> accessCertificates = findValidAndRemoveExpired(device);

    if (!device.isEnabled()) {
        log.info("Removing {} access certificates for disabled device {}", accessCertificates.size(), device.getId());
        // remove access certificates for disabled devices instead of throwing error
        // so the device certificates will be removed from the device.
        accessCertificateRepository.delete(accessCertificates);
        return Flux.empty();
    }

    Map<Long, VehicleEntity> vehicles = fetchVehicles(accessCertificates);

    return Flux.fromIterable(accessCertificates)
            .map(accessCertificateEntity -> {
                VehicleEntity vehicle = vehicles.get(accessCertificateEntity.getVehicleId());

                SignedAccessCertificateImpl signedAccessCertificate = SignedAccessCertificateImpl.builder()
                        .deviceAccessCertificateBase64(accessCertificateEntity
                                .getDeviceAccessCertificateBase64())
                        .deviceAccessCertificateSignatureBase64(accessCertificateEntity
                                .getDeviceAccessCertificateSignatureBase64()
                                .orElseThrow(IllegalStateException::new))
                        .signedDeviceAccessCertificateBase64(accessCertificateEntity
                                .getSignedDeviceAccessCertificateBase64()
                                .orElseThrow(IllegalStateException::new))
                        .vehicleAccessCertificateBase64(accessCertificateEntity
                                .getVehicleAccessCertificateBase64())
                        .vehicleAccessCertificateSignatureBase64(accessCertificateEntity
                                .getVehicleAccessCertificateSignatureBase64()
                                .orElseThrow(IllegalStateException::new))
                        .signedVehicleAccessCertificateBase64(accessCertificateEntity
                                .getSignedVehicleAccessCertificateBase64()
                                .orElseThrow(IllegalStateException::new))
                        .build();

                SignedAccessCertificateResource signedAccessCertificateResource = SignedAccessCertificateResourceImpl.builder()
                        .uuid(UUID.fromString(accessCertificateEntity.getUuid()))
                        .name(vehicle.getName())
                        .signedAccessCertificate(signedAccessCertificate)
                        .build();
                return signedAccessCertificateResource;
            });
}
 
开发者ID:amvnetworks,项目名称:amv-access-api-poc,代码行数:54,代码来源:AccessCertificateServiceImpl.java

示例8: invoke

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
@Override
public Flux<?> invoke(Flux<?> arg) {
    consumer.accept(arg);
    return Flux.empty();
}
 
开发者ID:fnproject,项目名称:fdk-java,代码行数:6,代码来源:SpringCloudConsumer.java


注:本文中的reactor.core.publisher.Flux.empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。