类 BuilderDefaults
java.lang.Object
springfox.documentation.builders.BuilderDefaults
This is a utility class with useful methods for builders
-
方法概要
修饰符和类型方法说明static <T> TdefaultIfAbsent(T newValue, T defaultValue) Returns this default value if the new value is nullstatic AllowableValuesemptyToNull(AllowableValues newValue, AllowableValues current) Retains current allowable values if then new value is nullstatic <T> List<T>nullToEmptyList(Collection<T> newValue) Returns an empty list if the newValue is nullstatic <K,V> Map<K, V> nullToEmptyMap(Map<K, V> newValue) Returns an empty map if the input is nullstatic <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 nullstatic <T> Set<T>nullToEmptySet(Set<T> newValue) Returns an empty set if the newValue is nullstatic <T> List<T>nullVarArgsToEmptyList(T... args) Returns an empty list if the newValue is nullstatic com.fasterxml.classmate.ResolvedTypereplaceIfMoreSpecific(com.fasterxml.classmate.ResolvedType replacement, com.fasterxml.classmate.ResolvedType defaultValue) Coalesces the resolved type.
-
方法详细资料
-
defaultIfAbsent
public static <T> T defaultIfAbsent(T newValue, T defaultValue) Returns this default value if the new value is null- 类型参数:
T- - Represents any type that is nullable- 参数:
newValue- - new valuedefaultValue- - default value- 返回:
- Coalesces the newValue and defaultValue to return a non-null value
-
nullToEmptyList
Returns an empty list if the newValue is null- 类型参数:
T- - any type- 参数:
newValue- - a list- 返回:
- non-null list
-
nullToEmptyMap
Returns an empty map if the input is null- 类型参数:
K- - map keyV- - map value- 参数:
newValue- - nullable map value- 返回:
- non-null Map
-
nullToEmptyMultimap
public 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- 类型参数:
K- - map keyV- - map value- 参数:
newValue- - nullable map value- 返回:
- non-null Map
-
nullToEmptySet
Returns an empty set if the newValue is null- 类型参数:
T- - any type- 参数:
newValue- - a set- 返回:
- non-null set
-
replaceIfMoreSpecific
public static com.fasterxml.classmate.ResolvedType replaceIfMoreSpecific(com.fasterxml.classmate.ResolvedType replacement, com.fasterxml.classmate.ResolvedType defaultValue) Coalesces the resolved type. Preservers the default value if the replacement is either null or represents a type that is less specific than the default value. For e.g. if default value represents a String then the replacement value has to be any value that is a subclass of Object. If it represents Object.class then the default value is preferred- 参数:
replacement- - replacement valuedefaultValue- - default value- 返回:
- most specific resolved type
-
nullVarArgsToEmptyList
Returns an empty list if the newValue is null- 类型参数:
T- - any type- 参数:
args- - a list- 返回:
- non-null list
-
emptyToNull
Retains current allowable values if then new value is null- 参数:
newValue- - new valuecurrent- - existing values- 返回:
- the appropriate value
-