List of usage examples for java.util.function Supplier get
T get();
From source file:org.springframework.data.gemfire.support.AbstractFactoryBeanSupport.java
/** * Logs the {@link String message} supplied by the given {@link Supplier} at warn level. * * @param message {@link Supplier} containing the {@link String message} and arguments to log. * @see org.apache.commons.logging.Log#isWarnEnabled() * @see org.apache.commons.logging.Log#warn(Object) * @see #getLog()// w w w . j a va 2 s. c o m */ protected void logWarning(Supplier<String> message) { Optional.ofNullable(getLog()).filter(Log::isWarnEnabled).ifPresent(log -> log.warn(message.get())); }
From source file:org.springframework.data.gemfire.support.AbstractFactoryBeanSupport.java
/** * Logs the {@link String message} supplied by the given {@link Supplier} at error level. * * @param message {@link Supplier} containing the {@link String message} and arguments to log. * @see org.apache.commons.logging.Log#isErrorEnabled() * @see org.apache.commons.logging.Log#error(Object) * @see #getLog()/* www . jav a 2s . co m*/ */ protected void logError(Supplier<String> message) { Optional.ofNullable(getLog()).filter(Log::isErrorEnabled).ifPresent(log -> log.error(message.get())); }
From source file:org.springframework.kafka.support.LogIfLevelEnabled.java
private void fatal(Supplier<Object> messageSupplier, Throwable t) { if (this.logger.isFatalEnabled()) { if (t != null) { this.logger.fatal(messageSupplier.get(), t); } else {//from w w w .jav a2s . co m this.logger.fatal(messageSupplier.get()); } } }
From source file:org.springframework.kafka.support.LogIfLevelEnabled.java
private void error(Supplier<Object> messageSupplier, Throwable t) { if (this.logger.isErrorEnabled()) { if (t != null) { this.logger.error(messageSupplier.get(), t); } else {/*w ww . j a v a 2s .co m*/ this.logger.error(messageSupplier.get()); } } }
From source file:org.springframework.kafka.support.LogIfLevelEnabled.java
private void warn(Supplier<Object> messageSupplier, Throwable t) { if (this.logger.isWarnEnabled()) { if (t != null) { this.logger.warn(messageSupplier.get(), t); } else {/*from w w w . j a v a 2 s . co m*/ this.logger.warn(messageSupplier.get()); } } }
From source file:org.springframework.kafka.support.LogIfLevelEnabled.java
private void info(Supplier<Object> messageSupplier, Throwable t) { if (this.logger.isInfoEnabled()) { if (t != null) { this.logger.info(messageSupplier.get(), t); } else {//from w ww .j a v a2s.c o m this.logger.info(messageSupplier.get()); } } }
From source file:org.springframework.kafka.support.LogIfLevelEnabled.java
private void debug(Supplier<Object> messageSupplier, Throwable t) { if (this.logger.isDebugEnabled()) { if (t != null) { this.logger.debug(messageSupplier.get(), t); } else {/*w w w . j a v a 2 s . c o m*/ this.logger.debug(messageSupplier.get()); } } }
From source file:org.springframework.kafka.support.LogIfLevelEnabled.java
private void trace(Supplier<Object> messageSupplier, Throwable t) { if (this.logger.isTraceEnabled()) { if (t != null) { this.logger.trace(messageSupplier.get(), t); } else {/* ww w . j a v a 2s . c om*/ this.logger.trace(messageSupplier.get()); } } }
From source file:org.springframework.web.reactive.function.server.RouterFunctions.java
private static <T> Mono<T> wrapException(Supplier<Mono<T>> supplier) { try {// ww w.j av a2 s . co m return supplier.get(); } catch (Throwable t) { return Mono.error(t); } }
From source file:org.springframework.web.reactive.result.HandlerResultHandlerSupport.java
@SuppressWarnings("unchecked") private List<MediaType> getProducibleTypes(ServerWebExchange exchange, Supplier<List<MediaType>> producibleTypesSupplier) { Set<MediaType> mediaTypes = exchange.getAttribute(HandlerMapping.PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE); return (mediaTypes != null ? new ArrayList<>(mediaTypes) : producibleTypesSupplier.get()); }