类 BuilderDefaults

java.lang.Object
springfox.documentation.builders.BuilderDefaults

public class BuilderDefaults extends Object
This is a utility class with useful methods for builders
  • 方法详细资料

    • 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 value
      defaultValue - - default value
      返回:
      Coalesces the newValue and defaultValue to return a non-null value
    • nullToEmptyList

      public static <T> List<T> nullToEmptyList(Collection<T> newValue)
      Returns an empty list if the newValue is null
      类型参数:
      T - - any type
      参数:
      newValue - - a list
      返回:
      non-null list
    • nullToEmptyMap

      public static <K, V> Map<K,V> nullToEmptyMap(Map<K,V> newValue)
      Returns an empty map if the input is null
      类型参数:
      K - - map key
      V - - 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 key
      V - - map value
      参数:
      newValue - - nullable map value
      返回:
      non-null Map
    • nullToEmptySet

      public static <T> Set<T> nullToEmptySet(Set<T> newValue)
      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 value
      defaultValue - - default value
      返回:
      most specific resolved type
    • nullVarArgsToEmptyList

      public static <T> List<T> nullVarArgsToEmptyList(T... args)
      Returns an empty list if the newValue is null
      类型参数:
      T - - any type
      参数:
      args - - a list
      返回:
      non-null list
    • emptyToNull

      public static AllowableValues emptyToNull(AllowableValues newValue, AllowableValues current)
      Retains current allowable values if then new value is null
      参数:
      newValue - - new value
      current - - existing values
      返回:
      the appropriate value