Package org.apache.bval.jsr.util
Class LookBehindRegexHolder
- java.lang.Object
-
- org.apache.bval.jsr.util.LookBehindRegexHolder
-
public class LookBehindRegexHolder extends Object
Utility class to manage regular expressions that require simulated infinite lookbehind, e.g. to determine whether a sequence of escape characters is complete unto itself.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_EXPANSION_BLOCK_SIZEstatic intDEFAULT_INITIAL_MAXIMUM_LENGTH
-
Constructor Summary
Constructors Constructor Description LookBehindRegexHolder(String regex, int initialMaximumLength, int expansionBlockSize, IntUnaryOperator computeInjectedRepetition)Create a newLookBehindRegexHolderinstance.LookBehindRegexHolder(String regex, IntUnaryOperator computeInjectedRepetition)Create a newLookBehindRegexHolderinstance with the default initial maximum length and expansion block size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) intgetMaximumLength()(package private) StringgetPattern()Matchermatcher(CharSequence s)Get aMatcheragainst the specifiedCharSequence.
-
-
-
Field Detail
-
DEFAULT_INITIAL_MAXIMUM_LENGTH
public static final int DEFAULT_INITIAL_MAXIMUM_LENGTH
- See Also:
- Constant Field Values
-
DEFAULT_EXPANSION_BLOCK_SIZE
public static final int DEFAULT_EXPANSION_BLOCK_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LookBehindRegexHolder
public LookBehindRegexHolder(String regex, IntUnaryOperator computeInjectedRepetition)
Create a newLookBehindRegexHolderinstance with the default initial maximum length and expansion block size.- Parameters:
regex- assumed to contain a%dJava format sequencecomputeInjectedRepetition- function to compute the injected number of repetitions to inject at%dinregex
-
LookBehindRegexHolder
public LookBehindRegexHolder(String regex, int initialMaximumLength, int expansionBlockSize, IntUnaryOperator computeInjectedRepetition)
Create a newLookBehindRegexHolderinstance.- Parameters:
regex- assumed to contain a%dJava format sequenceinitialMaximumLength- initial guessexpansionBlockSize- number of bytes by which to increase the maximum length when aMatcheris requested for a larger message sizecomputeInjectedRepetition- function to compute the injected number of repetitions to inject at%dinregex
-
-
Method Detail
-
matcher
public Matcher matcher(CharSequence s)
Get aMatcheragainst the specifiedCharSequence.- Parameters:
s-- Returns:
Matcher
-
getMaximumLength
int getMaximumLength()
-
getPattern
String getPattern()
-
-