Class AdapterUtils
java.lang.Object
ru.cg.webbpm.studio.subsystems.page_designer.serialization.impl.adapter.AdapterUtils
- Author:
- krylov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <B,T> T Returns null if prototype isn't null and the value equals prototype value, otherwise returns valuestatic booleanisEmpty(PropertyValue value) static booleanisEmpty(XmlArrayItem arrayItem) static booleanisEmpty(XmlPropertyValue value) static <V> Collection<V>nullIfEmpty(Collection<V> collection) Checks if collection is empty, returns null if it isstatic <K,V> Map<K, V> nullIfEmpty(Map<K, V> map) Checks if map is empty, returns null if it isstatic <T> ToneOf(T... values) Returns first non-null of passed valuesstatic <T> ToneOf(T o1, T o2) Optimized version ofoneOf(Object[])for two argumentsstatic <T> ToneOf(T o1, T o2, T o3) Optimized version ofoneOf(Object[])for three argumentsstatic <O,T> T returns getter value if value provided is not null, or null otherwise (imitates Kotlin ?.toSortedMap(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends U> valueMapper)
-
Constructor Details
-
AdapterUtils
public AdapterUtils()
-
-
Method Details
-
oneOf
public static <T> T oneOf(T o1, T o2) Optimized version ofoneOf(Object[])for two arguments -
oneOf
public static <T> T oneOf(T o1, T o2, T o3) Optimized version ofoneOf(Object[])for three arguments -
oneOf
Returns first non-null of passed values- Parameters:
values- list of values to check- Returns:
- first non-null value, or null if all values are null
-
toSortedMap
-
ifDiffer
Returns null if prototype isn't null and the value equals prototype value, otherwise returns value- Type Parameters:
B- bean typeT- value type- Parameters:
getter- getter for valueobject- a beanproto- nullable bean's prototype- Returns:
- either object value or null
-
nullIfEmpty
Checks if map is empty, returns null if it is- Parameters:
map- map to check- Returns:
- map provided, or null if it's empty
-
nullIfEmpty
Checks if collection is empty, returns null if it is- Parameters:
collection- collection to check- Returns:
- collection provided, or null if it's empty
-
isEmpty
-
isEmpty
-
isEmpty
-
safeCall
returns getter value if value provided is not null, or null otherwise (imitates Kotlin ?. operator)- Parameters:
object- nullable objectgetter- value getter- Returns:
- getter value, or null if object is null
-