Class StringLengthPredicate
- java.lang.Object
-
- me.s3ns3iw00.jcommands.argument.validator.type.StringLengthPredicate
-
- All Implemented Interfaces:
ArgumentPredicate<java.lang.String>
public class StringLengthPredicate extends java.lang.Object implements ArgumentPredicate<java.lang.String>
AnArgumentPredicate
that can be used on arguments withString
input type
It validates the length of the input with an inclusive range
-
-
Constructor Summary
Constructors Constructor Description StringLengthPredicate(int min, int max)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.function.Predicate<java.lang.String>
getPredicate()
static StringLengthPredicate
longerThan(int max)
Constructs the validation with only a maximum lengthstatic StringLengthPredicate
notInRage(int min, int max)
Constructs the validation with a rangestatic StringLengthPredicate
shorterThan(int min)
Constructs the validation with only a minimum length
-
-
-
Method Detail
-
getPredicate
public java.util.function.Predicate<java.lang.String> getPredicate()
- Specified by:
getPredicate
in interfaceArgumentPredicate<java.lang.String>
-
shorterThan
public static StringLengthPredicate shorterThan(int min)
Constructs the validation with only a minimum length- Parameters:
min
- the minimum length- Returns:
- the
StringLengthPredicate
-
longerThan
public static StringLengthPredicate longerThan(int max)
Constructs the validation with only a maximum length- Parameters:
max
- the maximum length- Returns:
- the
StringLengthPredicate
-
notInRage
public static StringLengthPredicate notInRage(int min, int max)
Constructs the validation with a range- Parameters:
min
- the minimum lengthmax
- the maximum length- Returns:
- the
StringLengthPredicate
-
-