Spring Data for VMware GemFire
Class SpringExtensions
java.lang.Object
org.springframework.data.gemfire.util.SpringExtensions
- Direct Known Subclasses:
DistributedSystemUtils
Abstract utility class encapsulating functionality common to
Objects, Class types
and Spring beans.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic interface -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.beans.factory.config.BeanDefinitionaddDependsOn(org.springframework.beans.factory.config.BeanDefinition beanDefinition, String... beanNames) Adds an array of bean dependencies (byname) to the givenBeanDefinition.static booleanareNotNull(Object... values) Determines whether all theObjectvalues in the array are non-null.static StringdefaultIfEmpty(String value, String defaultValue) static StringdefaultIfEmpty(String value, Supplier<String> supplier) static <T> TdefaultIfNull(T value, Supplier<T> supplier) static <T> TdefaultIfNull(T value, T defaultValue) static StringdereferenceBean(String beanName) static booleanequalsIgnoreNull(Object obj1, Object obj2) static <T> List<T>getBeansOfTypeOrdered(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory, Class<T> beanType) static <T> List<T>getBeansOfTypeOrdered(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory, Class<T> beanType, boolean includeNonSingletons, boolean allowEagerInit) static Integerstatic <T> Stream<T>getOrderedStreamOfBeansByType(org.springframework.beans.factory.BeanFactory beanFactory, Class<T> beanType) getPropertyValue(org.springframework.beans.factory.config.BeanDefinition beanDefinition, String propertyName) static booleanisMatchingBean(org.springframework.beans.factory.BeanFactory beanFactory, String beanName, Class<?> beanType) static booleannullOrEquals(Object obj1, Object obj2) static booleannullSafeEquals(Object obj1, Object obj2) static StringnullSafeName(Class<?> type) static StringnullSafeSimpleName(Class<?> type) static Class<?>nullSafeType(Object target) static Class<?>nullSafeType(Object target, Class<?> defaultType) static <T> TrequireObject(Supplier<T> objectSupplier, String message) static <T> TrequireObject(T object, String message) static booleanstatic booleansafeDoOperation(SpringExtensions.VoidReturningThrowableOperation operation, Runnable backupOperation) static <T> Tstatic <T> TsafeGetValue(SpringExtensions.ValueReturningThrowableOperation<T> operation, Function<Throwable, T> exceptionHandler) static <T> TsafeGetValue(SpringExtensions.ValueReturningThrowableOperation<T> operation, Supplier<T> defaultValueSupplier) static <T> TsafeGetValue(SpringExtensions.ValueReturningThrowableOperation<T> operation, T defaultValue) static voidstatic voidsafeRunOperation(SpringExtensions.VoidReturningThrowableOperation operation, Function<Throwable, RuntimeException> exceptionConverter) static org.springframework.beans.factory.config.BeanDefinitionsetPropertyReference(org.springframework.beans.factory.config.BeanDefinition beanDefinition, String propertyName, String beanName) static org.springframework.beans.factory.config.BeanDefinitionsetPropertyValue(org.springframework.beans.factory.config.BeanDefinition beanDefinition, String propertyName, Object propertyValue)
-
Constructor Details
-
SpringExtensions
public SpringExtensions()
-
-
Method Details
-
areNotNull
Determines whether all theObjectvalues in the array are non-null. -
isMatchingBean
-
addDependsOn
@NonNull public static org.springframework.beans.factory.config.BeanDefinition addDependsOn(@NonNull org.springframework.beans.factory.config.BeanDefinition beanDefinition, String... beanNames) Adds an array of bean dependencies (byname) to the givenBeanDefinition.- Parameters:
beanDefinition-BeanDefinitionto add the bean dependencies; must not be null.beanNames- array ofnamesof beans for which theBeanDefinitiondepends on, or will have a dependency.- Returns:
- the given
BeanDefinition. - See Also:
-
BeanDefinition
-
getBeansOfTypeOrdered
@NonNull public static <T> List<T> getBeansOfTypeOrdered(@NonNull org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory, @NonNull Class<T> beanType) - Type Parameters:
T-typeof the bean.- Parameters:
beanFactory-Spring containerused to acquire the ordered beans.beanType-typeof beans to acquire.- Returns:
- a
Listof beans of the giventypein order. - See Also:
-
getBeansOfTypeOrdered(ConfigurableListableBeanFactory, Class, boolean, boolean)ConfigurableListableBeanFactoryClassList
-
getBeansOfTypeOrdered
@NonNull public static <T> List<T> getBeansOfTypeOrdered(@NonNull org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory, @NonNull Class<T> beanType, boolean includeNonSingletons, boolean allowEagerInit) - Type Parameters:
T-typeof the bean.- Parameters:
beanFactory-Spring containerused to acquire the ordered beans.beanType-typeof beans to acquire.includeNonSingletons- boolean indicating whether to include non-Singleton beans from the Spring container.allowEagerInit- boolean indicating whether to eagerly initializeFactoryBeans.- Returns:
- a
Listof beans of the giventypein order. - See Also:
-
getOrder
-
getOrderedStreamOfBeansByType
-
getPropertyValue
-
setPropertyReference
-
setPropertyValue
-
defaultIfEmpty
-
defaultIfEmpty
-
defaultIfNull
public static <T> T defaultIfNull(T value, T defaultValue) -
defaultIfNull
-
dereferenceBean
-
equalsIgnoreNull
-
nullOrEquals
-
nullSafeEquals
-
nullSafeName
-
nullSafeSimpleName
-
nullSafeType
-
nullSafeType
-
requireObject
-
requireObject
-
safeDoOperation
-
safeDoOperation
public static boolean safeDoOperation(SpringExtensions.VoidReturningThrowableOperation operation, Runnable backupOperation) -
safeGetValue
-
safeGetValue
public static <T> T safeGetValue(SpringExtensions.ValueReturningThrowableOperation<T> operation, T defaultValue) -
safeGetValue
public static <T> T safeGetValue(SpringExtensions.ValueReturningThrowableOperation<T> operation, Supplier<T> defaultValueSupplier) -
safeGetValue
public static <T> T safeGetValue(SpringExtensions.ValueReturningThrowableOperation<T> operation, Function<Throwable, T> exceptionHandler) -
safeRunOperation
-
safeRunOperation
public static void safeRunOperation(SpringExtensions.VoidReturningThrowableOperation operation, Function<Throwable, RuntimeException> exceptionConverter)
-