Class NumberPredicate
- java.lang.Object
-
- org.solidcoding.validation.predicates.ObjectPredicate<Integer>
-
- org.solidcoding.validation.predicates.NumberPredicate
-
- All Implemented Interfaces:
Predicate<Integer>,PredicateAppender<Integer>
public final class NumberPredicate extends ObjectPredicate<Integer>
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Predicate<Integer>contains(Integer value, Integer... values)Checks whether the given Integers are present anywhere in the value.static Predicate<Integer>doesNotContain(Integer value, Integer... values)Checks whether the given Integers are not present anywhere in the value.static Predicate<Integer>hasAmountOfDigits(int amountOfDigits)static ConstraintAppender<Integer,Predicate<Integer>>isBetween(int first)static Predicate<Integer>isEqualTo(int value)Check if the actual value is equal to the given one.static Predicate<Integer>isNotNull()Checks whether the actual value is present.static Predicate<Integer>isNull()Checks whether the actual value is not present.-
Methods inherited from class org.solidcoding.validation.predicates.ObjectPredicate
isA, isAn, isEqualTo, test
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.solidcoding.validation.predicates.PredicateAppender
that, that, where, where
-
-
-
-
Method Detail
-
isNotNull
public static Predicate<Integer> isNotNull()
Checks whether the actual value is present.- Returns:
- Predicate to continue adding rules.
-
isNull
public static Predicate<Integer> isNull()
Checks whether the actual value is not present.- Returns:
- Predicate to continue adding rules.
-
isEqualTo
public static Predicate<Integer> isEqualTo(int value)
Check if the actual value is equal to the given one.- Parameters:
value- the exact expected value.- Returns:
- Predicate to continue adding rules.
-
hasAmountOfDigits
public static Predicate<Integer> hasAmountOfDigits(int amountOfDigits)
- Parameters:
amountOfDigits- the exact amount of digits of the Integer.- Returns:
- Predicate to continue adding rules.
-
isBetween
public static ConstraintAppender<Integer,Predicate<Integer>> isBetween(int first)
- Parameters:
first- the first (inclusive) constraint. Can be either the high constraint or the low constraint.- Returns:
- a ChainingPredicate to add the second constraint.
-
contains
public static Predicate<Integer> contains(Integer value, Integer... values)
Checks whether the given Integers are present anywhere in the value.- Parameters:
value- the exact value that needs to be present in the toString of the original value.values- the optional exact values that needs to be present in the toString of the original value.- Returns:
- Predicate to continue adding rules.
-
doesNotContain
public static Predicate<Integer> doesNotContain(Integer value, Integer... values)
Checks whether the given Integers are not present anywhere in the value.- Parameters:
value- the exact value that may not be present in the toString of the original value.values- the optional exact values that may not be present in the toString of the original value.- Returns:
- Predicate to continue adding rules.
-
-