public abstract class RandomPattern extends java.lang.Object implements Pattern
A random pattern will generate a random string and the string will satisfy the pattern definition.
This class implements the Pattern
interface.
Pattern
Constructor and Description |
---|
RandomPattern()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getCode()
This method gets the generated random code
|
char[] |
getCodeset()
This method gets the character set
|
char |
getMaskCharacter()
This method gets the mask character
|
java.lang.String |
getPatternDefinition()
This method gets the pattern definition
|
java.math.BigDecimal |
getPatternSpace()
This method calculates the total number of all random codes
|
void |
setCharacterSet(char[] charactersetIn)
This method sets the character set
|
void |
setMaskCharacter(char maskIn)
This method sets the mask character
|
void |
setPatternDefinition(java.lang.String patternDefIn)
This method sets the pattern definition
|
boolean |
validatePattern()
This method validates the pattern definition
|
public java.lang.String getCode()
getCode
in interface Pattern
Pattern.getCode()
public java.math.BigDecimal getPatternSpace()
getPatternSpace
in interface Pattern
Pattern.getPatternSpace()
public boolean validatePattern()
If the pattern definition is null or the length of the pattern definition is zero, it will return false
.
If any character inside the pattern is not the mask character, it will return false
.
If all above conditions are not satisfied, the method will read the length of the pattern and return true
.
validatePattern
in interface Pattern
Pattern.validatePattern()
public java.lang.String getPatternDefinition()
getPatternDefinition
in interface Pattern
Pattern.getPatternDefinition()
public char getMaskCharacter()
getMaskCharacter
in interface Pattern
Pattern.getMaskCharacter()
public void setMaskCharacter(char maskIn)
maskIn
- The mask characterpublic void setPatternDefinition(java.lang.String patternDefIn)
setPatternDefinition
in interface Pattern
patternDefIn
- The pattern segment stringPattern.setPatternDefinition(String)
public char[] getCodeset()
public void setCharacterSet(char[] charactersetIn)
charactersetIn
- The input character set