Class NullUtils

java.lang.Object
org.openrewrite.internal.lang.NullUtils

public class NullUtils extends Object
  • Constructor Details

    • NullUtils

      public NullUtils()
  • Method Details

    • findNonNullFields

      public static List<Field> findNonNullFields(@NonNull @NonNull Class<?> _class)
      The method uses reflection to find all declared fields of a class that have been marked (via commonly used annotations) as being Non-Null, or a required Option. This method will also look at the class's package level to see if the API for that package is defaulted as Non-Null. Fields with explicit Nullable annotations will be excluded. Any other annotation that has runtime retention and matches one of the simple annotation names (minus any package) will be considered a match.
      Parameters:
      _class - The class to reflect over
      Returns:
      A list of fields marked as non-null, sorted by their name in alphabetical order.