public abstract class SpringUtils extends Object
Class,
Object,
Function,
Stream,
BeanFactory,
FactoryBean,
BeanDefinition,
RuntimeBeanReference,
Ordered,
AnnotationAwareOrderComparator,
Order| Modifier and Type | Class and Description |
|---|---|
static interface |
SpringUtils.OrderedBeanWrapper<T> |
static interface |
SpringUtils.ValueReturningThrowableOperation<T> |
static interface |
SpringUtils.VoidReturningExceptionThrowingOperation
Deprecated.
|
static interface |
SpringUtils.VoidReturningThrowableOperation |
| Constructor and Description |
|---|
SpringUtils() |
public static boolean isMatchingBean(@NonNull BeanFactory beanFactory, String beanName, Class<?> beanType)
beanFactory - Spring container in which to resolve the bean.beanName - name of the bean.beanType - type of the bean.Spring container contains a bean
matching by both name and type.BeanFactory,
Class,
String@NonNull public static BeanDefinition addDependsOn(@NonNull BeanDefinition beanDefinition, @Nullable String... beanNames)
BeanDefinition.beanDefinition - BeanDefinition to add the bean dependencies to.beanNames - String array containing names of beans to which the BeanDefinition
has a dependency.BeanDefinition.BeanDefinitionpublic static <T> Stream<T> getOrderedStreamOfBeansByType(@NonNull BeanFactory beanFactory, @NonNull Class<T> beanType)
T - type of the beans.beanFactory - BeanFactory from which to acquire the beans.beanType - type of the beans.Stream of beans from the BeanFactory of the given type.BeanFactory,
Stream,
Classpublic static Optional<Object> getPropertyValue(BeanDefinition beanDefinition, String propertyName)
public static BeanDefinition setPropertyReference(BeanDefinition beanDefinition, String propertyName, String beanName)
public static BeanDefinition setPropertyValue(BeanDefinition beanDefinition, String propertyName, Object propertyValue)
public static <T> T defaultIfNull(T value,
T defaultValue)
public static <T> T defaultIfNull(T value,
Supplier<T> supplier)
public static boolean safeDoOperation(SpringUtils.VoidReturningThrowableOperation operation)
public static boolean safeDoOperation(SpringUtils.VoidReturningThrowableOperation operation, Runnable backupOperation)
public static <T> T safeGetValue(SpringUtils.ValueReturningThrowableOperation<T> operation)
public static <T> T safeGetValue(SpringUtils.ValueReturningThrowableOperation<T> operation, T defaultValue)
public static <T> T safeGetValue(SpringUtils.ValueReturningThrowableOperation<T> operation, Supplier<T> defaultValueSupplier)
public static <T> T safeGetValue(SpringUtils.ValueReturningThrowableOperation<T> operation, Function<Throwable,T> exceptionHandler)
public static void safeRunOperation(SpringUtils.VoidReturningThrowableOperation operation)
public static void safeRunOperation(SpringUtils.VoidReturningThrowableOperation operation, Function<Throwable,RuntimeException> exceptionConverter)
Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.