Package tethys.niluswraps
Class NilusChecker
java.lang.Object
tethys.niluswraps.NilusChecker
A few static checks of some nilus classes to see if it's
worth writing them or not.
- Author:
- dg50
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheckEmptyFields(Object nilusObject) Check an object for empty and required fields.findEmptyFields(Object nilusObject, boolean onlyRequired) Find empty fieldsstatic booleanTest if an object is empty.static booleanisEmptyString(String string) A String is empty if it is null or of zero lengthstatic voidstatic intremoveEmptyFields(Object nilusObject) Remove empty fields from a nilus object.static booleanwarnEmptyFields(Window owner, Object nilusObject)
-
Constructor Details
-
NilusChecker
public NilusChecker()
-
-
Method Details
-
main
-
warnEmptyFields
-
findEmptyFields
Find empty fields- Parameters:
nilusObject- object to searchonlyRequired- only list required fields.- Returns:
- list of empty, and optionally also required, fields.
-
removeEmptyFields
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
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
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
- Parameters:
nilusObject-- Returns:
- true if it's empty
-
isEmptyString
A String is empty if it is null or of zero length- Parameters:
string- string- Returns:
- true if empty
-