Class StringPredicateBuilder

    • Method Detail

      • isNotNull

        public static Predicate<String> isNotNull()
        Checks whether the actual value is present.*
        Returns:
        Predicate to continue adding rules.
      • contains

        public static Predicate<String> contains​(CharSequence value,
                                                 CharSequence... values)
        Checks whether the given charSequences are present anywhere in the value.
        Parameters:
        value - the exact value that needs to be present in the original value.
        values - the optional exact values that needs to be present in the original value.
        Returns:
        Predicate to continue adding rules.
      • doesNotContain

        public static Predicate<String> doesNotContain​(CharSequence value,
                                                       CharSequence... values)
        Checks whether the given charSequences are present anywhere in the value.
        Parameters:
        value - the exact value that may not be present in the original value.
        values - the optional exact values that may not be present in the original value.
        Returns:
        Predicate to continue adding rules.
      • is

        public static Predicate<String> is​(String value)
        Check if the actual value is equal to the given one.
        Parameters:
        value - the exact expected value.
        Returns:
        StringPredicate to continue adding rules.
      • is

        public static Predicate<String> is​(Predicate<String> rule)
        Parameters:
        rule - the custom predicate to test against the String.
        Returns:
        StringPredicate to continue adding rules.
      • hasALengthBetween

        public static ChainingPredicate<Integer,​Predicate<String>> hasALengthBetween​(int length)
        Parameters:
        length - the exact length of the String.
        Returns:
        StringPredicate to continue adding rules.
      • hasALengthOf

        public static Predicate<String> hasALengthOf​(int length)
        Parameters:
        length - the exact length of the String.
        Returns:
        StringPredicate to continue adding rules.
      • isNumeric

        public static Predicate<String> isNumeric()
        Adds a check if all characters are in fact digits.
        Returns:
        StringPredicate to continue adding rules.
      • isNotNumeric

        public static Predicate<String> isNotNumeric()
        Adds a check if any character is in fact not a digit.
        Returns:
        StringPredicate to continue adding rules.
      • isAlphabetic

        public static Predicate<String> isAlphabetic()
        Adds a check if all characters are in fact digits.
        Returns:
        StringPredicate to continue adding rules.
      • isNotAlphabetic

        public static Predicate<String> isNotAlphabetic()
        Adds a check if any character is in fact not alphabetic.
        Returns:
        StringPredicate to continue adding rules.
      • test

        public boolean test​(T value)
        Specified by:
        test in interface Predicate<T>
      • where

        public Predicate<T> where​(Predicate<T> rule)
        Specified by:
        where in interface GenericPredicate<T>
        Parameters:
        rule - the custom predicate to test against properties of T.
        Returns:
        ObjectPredicate to continue adding rules.