public class DefaultRandomStringProvider extends AbstractRandomDataProvider<String> implements RandomStringProvider
| Constructor and Description |
|---|
DefaultRandomStringProvider() |
DefaultRandomStringProvider(int defaultLen) |
DefaultRandomStringProvider(int defaultMinLen,
int defaultMaxLen) |
DefaultRandomStringProvider(RandomStringType type) |
DefaultRandomStringProvider(RandomStringType type,
int defaultLen) |
DefaultRandomStringProvider(RandomStringType type,
int defaultMinLen,
int defaultMaxLen) |
| Modifier and Type | Method and Description |
|---|---|
String |
get()
Retrieve a random data.
|
protected int |
getLength() |
protected String |
getPostfix() |
protected String |
getPrefix() |
protected RandomStringType |
getStringType() |
RandomStringProvider |
length(int len)
Specify the exact length of the strings to return.
|
RandomStringProvider |
maxLength(int len)
Specify the maximum length of the strings to return.
|
RandomStringProvider |
minLength(int len)
Specify the minimum length of the strings to return.
|
RandomStringProvider |
postfix(String postfix)
Specify a postfix to attach to the random string.
|
RandomStringProvider |
prefix(String prefix)
Specify a prefix to put in front of the random string.
|
String |
toString() |
RandomStringProvider |
type(RandomStringType type)
Specify the type of characters to create.
|
fixateclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitfixatepublic DefaultRandomStringProvider()
public DefaultRandomStringProvider(@Nonnegative int defaultLen)
public DefaultRandomStringProvider(@Nonnegative int defaultMinLen, @Nonnegative int defaultMaxLen)
public DefaultRandomStringProvider(@Nonnull RandomStringType type)
public DefaultRandomStringProvider(@Nonnull RandomStringType type, @Nonnegative int defaultLen)
public DefaultRandomStringProvider(@Nonnull RandomStringType type, @Nonnegative int defaultMinLen, @Nonnegative int defaultMaxLen)
public String get() throws DataProvidingException
DataProviderget in interface DataProvider<String>DataProvidingException - if an error occurred during data generation@Nonnegative protected final int getLength() throws DataProvidingException
DataProvidingException@Nonnull protected final RandomStringType getStringType()
@Nonnull public final RandomStringProvider type(@Nonnull RandomStringType type)
RandomStringProviderSpecify the type of characters to create.
type in interface RandomStringProvidertype - character type@Nonnull public final RandomStringProvider length(@Nonnegative int len)
RandomStringProviderSpecify the exact length of the strings to return. Sets maximum and minimum length to the same value.
length in interface RandomStringProviderlen - the length of the strings to create@Nonnull public final RandomStringProvider maxLength(@Nonnegative int len)
RandomStringProviderSpecify the maximum length of the strings to return.
maxLength in interface RandomStringProviderlen - maximum length of strings@Nonnull public final RandomStringProvider minLength(@Nonnegative int len)
RandomStringProviderSpecify the minimum length of the strings to return.
minLength in interface RandomStringProviderlen - minimum length of strings@Nonnull public RandomStringProvider postfix(@Nullable String postfix)
RandomStringProviderSpecify a postfix to attach to the random string. This is sometimes useful in order to assist assertions to be easy to interpret. The postfix length is subtracted from the total valid length of the generated string. So it must not exceed the maximum length.
postfix in interface RandomStringProviderpostfix - postfix for the string; null or empty string for no postfix@Nonnull public RandomStringProvider prefix(@Nullable String prefix)
RandomStringProviderSpecify a prefix to put in front of the random string. This is sometimes useful in order to assist assertions to be easy to interpret. The prefix length is subtracted from the total valid length of the generated string. So it must not exceed the maximum length.
prefix in interface RandomStringProviderprefix - prefix for the string; null or empty string for no prefixCopyright © 2011-2013 CoreMedia AG. All Rights Reserved.