Class PrerequisiteChecker


  • public class PrerequisiteChecker
    extends Object
    This is a class meant for chaining together calls like PrerequisiteChecker.checkThat().notNull(ob1, ob2).notEmpty(coll).withNames("ob1", "ob2", "coll").execute(). In case that any of the checks fail on execute(), a message will be recorded for each failed check. Then, an IllegalArgumentException is thrown explaining what went wrong.
    • Method Detail

      • withNames

        public PrerequisiteChecker withNames​(String... names)
        Sets the names for all items previously added to the checker, possibly in multiple calls. The number of names may lower or even higher than the number of given items. In the first case, the names will be assigned to the checked items from left to right in a continuous manner while the remaining items will receive null as their name. In the second case, all superfluous names will simply be ignored.
        Parameters:
        names - The names to give to the last list of items to check
        Returns:
        This object for chaining.
      • execute

        public void execute()
        Checks for null items and, if found, generates an error message.