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 int
DEFAULT_EXPANSION_BLOCK_SIZE
static int
DEFAULT_INITIAL_MAXIMUM_LENGTH
-
Constructor Summary
Constructors Constructor Description LookBehindRegexHolder(String regex, int initialMaximumLength, int expansionBlockSize, IntUnaryOperator computeInjectedRepetition)
Create a newLookBehindRegexHolder
instance.LookBehindRegexHolder(String regex, IntUnaryOperator computeInjectedRepetition)
Create a newLookBehindRegexHolder
instance 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) int
getMaximumLength()
(package private) String
getPattern()
Matcher
matcher(CharSequence s)
Get aMatcher
against 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 newLookBehindRegexHolder
instance with the default initial maximum length and expansion block size.- Parameters:
regex
- assumed to contain a%d
Java format sequencecomputeInjectedRepetition
- function to compute the injected number of repetitions to inject at%d
inregex
-
LookBehindRegexHolder
public LookBehindRegexHolder(String regex, int initialMaximumLength, int expansionBlockSize, IntUnaryOperator computeInjectedRepetition)
Create a newLookBehindRegexHolder
instance.- Parameters:
regex
- assumed to contain a%d
Java format sequenceinitialMaximumLength
- initial guessexpansionBlockSize
- number of bytes by which to increase the maximum length when aMatcher
is requested for a larger message sizecomputeInjectedRepetition
- function to compute the injected number of repetitions to inject at%d
inregex
-
-
Method Detail
-
matcher
public Matcher matcher(CharSequence s)
Get aMatcher
against the specifiedCharSequence
.- Parameters:
s
-- Returns:
Matcher
-
getMaximumLength
int getMaximumLength()
-
getPattern
String getPattern()
-
-