public class BuilderDefaults
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <T> T |
defaultIfAbsent(T newValue,
T defaultValue)
Returns this default value if the new value is null
|
static AllowableValues |
emptyToNull(AllowableValues newValue,
AllowableValues current)
Retains current allowable values if then new value is null
|
static <T> java.util.List<T> |
nullToEmptyList(java.util.Collection<T> newValue)
Returns an empty list if the newValue is null
|
static <K,V> java.util.Map<K,V> |
nullToEmptyMap(java.util.Map<K,V> newValue)
Returns an empty map if the input is null
|
static <K,V> com.google.common.collect.Multimap<K,V> |
nullToEmptyMultimap(com.google.common.collect.Multimap<K,V> newValue)
Returns an empty map if the input is null
|
static <T> java.util.Set<T> |
nullToEmptySet(java.util.Set<T> newValue)
Returns an empty set if the newValue is null
|
static <T> java.util.List<T> |
nullVarArgsToEmptyList(T... args)
Returns an empty list if the newValue is null
|
static com.fasterxml.classmate.ResolvedType |
replaceIfMoreSpecific(com.fasterxml.classmate.ResolvedType replacement,
com.fasterxml.classmate.ResolvedType defaultValue)
Coalesces the resolved type.
|
public static <T> T defaultIfAbsent(T newValue, T defaultValue)
T
- - Represents any type that is nullablenewValue
- - new valuedefaultValue
- - default valuepublic static <T> java.util.List<T> nullToEmptyList(java.util.Collection<T> newValue)
T
- - any typenewValue
- - a listpublic static <K,V> java.util.Map<K,V> nullToEmptyMap(java.util.Map<K,V> newValue)
K
- - map keyV
- - map valuenewValue
- - nullable map valuepublic static <K,V> com.google.common.collect.Multimap<K,V> nullToEmptyMultimap(com.google.common.collect.Multimap<K,V> newValue)
K
- - map keyV
- - map valuenewValue
- - nullable map valuepublic static <T> java.util.Set<T> nullToEmptySet(java.util.Set<T> newValue)
T
- - any typenewValue
- - a setpublic static com.fasterxml.classmate.ResolvedType replaceIfMoreSpecific(com.fasterxml.classmate.ResolvedType replacement, com.fasterxml.classmate.ResolvedType defaultValue)
replacement
- - replacement valuedefaultValue
- - default valuepublic static <T> java.util.List<T> nullVarArgsToEmptyList(T... args)
T
- - any typeargs
- - a listpublic static AllowableValues emptyToNull(AllowableValues newValue, AllowableValues current)
newValue
- - new valuecurrent
- - existing values