public class PostalCodeRandomField extends Object implements RandomField
| Modifier and Type | Field and Description |
|---|---|
static String |
KEY_DIGIT
Key that can be used by the pattern to display a single digit.
|
static String |
KEY_LETTER
Key that can be used by the pattern to display a single letter.
|
static String |
PATTERN_CANADA
Pattern used in Canada, e.g.
|
static String |
PATTERN_GERMANY
Pattern used in Germany, e.g.
|
static String |
PATTERN_US
Pattern used in the US, e.g.
|
RND| Constructor and Description |
|---|
PostalCodeRandomField()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
double |
getNullProbability()
Returns the probability for this field returning null.
|
String |
getPattern()
Returns the pattern with keys that get replaced during
nextValue(). |
String |
nextValue()
Returns a random value.
|
PostalCodeRandomField |
nullProbability(double newNullProbability)
Sets the probability for this field returning null.
|
PostalCodeRandomField |
pattern(String newPattern)
Sets the pattern with keys that get replaced during
nextValue(). |
void |
setNullProbability(double nullProbability)
Sets the probability for this field returning null.
|
void |
setPattern(String pattern)
Sets the pattern with keys that get replaced during
nextValue(). |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinitpublic static final String KEY_DIGIT
public static final String KEY_LETTER
public static final String PATTERN_GERMANY
public static final String PATTERN_US
public static final String PATTERN_CANADA
public String nextValue()
RandomFieldnextValue in interface RandomFieldpublic String getPattern()
nextValue(). Known
keys are:
public PostalCodeRandomField pattern(String newPattern)
nextValue(). Known
keys are:
newPattern - the patternpublic void setPattern(String pattern)
nextValue(). Known
keys are:
pattern - the patternpublic double getNullProbability()
nextValue() is null, if it is 1 then every nextValue() is null.public PostalCodeRandomField nullProbability(double newNullProbability)
nextValue() is null, if it is 1 then every nextValue() is null.newNullProbability - the probability between 0 and 1public void setNullProbability(double nullProbability)
nextValue() is null, if it is 1 then every nextValue() is null.nullProbability - the probability between 0 and 1Copyright © 2020. All rights reserved.