use of org.springframework.boot.context.properties.PropertyMapper in project spring-boot by spring-projects.
the class RepositoryRestProperties method applyTo.
public void applyTo(RepositoryRestConfiguration rest) {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(this::getBasePath).to(rest::setBasePath);
map.from(this::getDefaultPageSize).to(rest::setDefaultPageSize);
map.from(this::getMaxPageSize).to(rest::setMaxPageSize);
map.from(this::getPageParamName).to(rest::setPageParamName);
map.from(this::getLimitParamName).to(rest::setLimitParamName);
map.from(this::getSortParamName).to(rest::setSortParamName);
map.from(this::getDetectionStrategy).to(rest::setRepositoryDetectionStrategy);
map.from(this::getDefaultMediaType).to(rest::setDefaultMediaType);
map.from(this::getReturnBodyOnCreate).to(rest::setReturnBodyOnCreate);
map.from(this::getReturnBodyOnUpdate).to(rest::setReturnBodyOnUpdate);
map.from(this::getEnableEnumTranslation).to(rest::setEnableEnumTranslation);
}
use of org.springframework.boot.context.properties.PropertyMapper in project spring-boot by spring-projects.
the class TaskExecutorBuilder method configure.
/**
* Configure the provided {@link ThreadPoolTaskExecutor} instance using this builder.
* @param <T> the type of task executor
* @param taskExecutor the {@link ThreadPoolTaskExecutor} to configure
* @return the task executor instance
* @see #build()
* @see #build(Class)
*/
public <T extends ThreadPoolTaskExecutor> T configure(T taskExecutor) {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(this.queueCapacity).to(taskExecutor::setQueueCapacity);
map.from(this.corePoolSize).to(taskExecutor::setCorePoolSize);
map.from(this.maxPoolSize).to(taskExecutor::setMaxPoolSize);
map.from(this.keepAlive).asInt(Duration::getSeconds).to(taskExecutor::setKeepAliveSeconds);
map.from(this.allowCoreThreadTimeOut).to(taskExecutor::setAllowCoreThreadTimeOut);
map.from(this.awaitTermination).to(taskExecutor::setWaitForTasksToCompleteOnShutdown);
map.from(this.awaitTerminationPeriod).as(Duration::toMillis).to(taskExecutor::setAwaitTerminationMillis);
map.from(this.threadNamePrefix).whenHasText().to(taskExecutor::setThreadNamePrefix);
map.from(this.taskDecorator).to(taskExecutor::setTaskDecorator);
if (!CollectionUtils.isEmpty(this.customizers)) {
this.customizers.forEach((customizer) -> customizer.customize(taskExecutor));
}
return taskExecutor;
}
use of org.springframework.boot.context.properties.PropertyMapper in project spring-boot by spring-projects.
the class NettyRSocketServerFactory method configureServer.
private void configureServer(io.rsocket.core.RSocketServer server) {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(this.fragmentSize).asInt(DataSize::toBytes).to(server::fragment);
this.rSocketServerCustomizers.forEach((customizer) -> customizer.customize(server));
}
use of org.springframework.boot.context.properties.PropertyMapper in project spring-boot by spring-projects.
the class WavefrontMetricsExportAutoConfiguration method createWavefrontSender.
private WavefrontSender createWavefrontSender(WavefrontConfig wavefrontConfig) {
Builder builder = WavefrontMeterRegistry.getDefaultSenderBuilder(wavefrontConfig);
PropertyMapper mapper = PropertyMapper.get().alwaysApplyingWhenNonNull();
Sender sender = this.properties.getSender();
mapper.from(sender.getMaxQueueSize()).to(builder::maxQueueSize);
mapper.from(sender.getFlushInterval()).asInt(Duration::getSeconds).to(builder::flushIntervalSeconds);
mapper.from(sender.getMessageSize()).asInt(DataSize::toBytes).to(builder::messageSizeBytes);
return builder.build();
}
Aggregations