Class NilusChecker

java.lang.Object
tethys.niluswraps.NilusChecker

public class NilusChecker extends Object
A few static checks of some nilus classes to see if it's worth writing them or not.
Author:
dg50
  • Constructor Details

    • NilusChecker

      public NilusChecker()
  • Method Details

    • main

      public static void main(String[] args)
    • warnEmptyFields

      public static boolean warnEmptyFields(Window owner, Object nilusObject)
    • findEmptyFields

      public static ArrayList<Field> findEmptyFields(Object nilusObject, boolean onlyRequired)
      Find empty fields
      Parameters:
      nilusObject - object to search
      onlyRequired - only list required fields.
      Returns:
      list of empty, and optionally also required, fields.
    • removeEmptyFields

      public static int removeEmptyFields(Object nilusObject)
      Remove empty fields from a nilus object.
      An empty field is a field that is null, or has a String that is empty, or only contains elements which are all themselves empty. i.e. an object that references empty objects will be considered empty.
      Parameters:
      nilusObject -
      Returns:
      number of empty fields removed.
    • checkEmptyFields

      public static ArrayList<Field> checkEmptyFields(Object nilusObject)
      Check an object for empty and required fields.
      Parameters:
      nilusObject -
      Returns:
      a list of required empty fields in the nilusObjec and any objects references by that object.
    • isEmpty

      public static boolean isEmpty(Object nilusObject)
      Test if an object is empty.
      An object is considered empty if any of the following criteria are met:
      • The object is null
      • The object is a zero length string
      • The object is not null, but all of it's fields satisfy this same criteria of being empty
      • The object is a list which has no elements
      Primitive types are never empty.
      Parameters:
      nilusObject -
      Returns:
      true if it's empty
    • isEmptyString

      public static boolean isEmptyString(String string)
      A String is empty if it is null or of zero length
      Parameters:
      string - string
      Returns:
      true if empty