@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class ValuePattern extends java.lang.Object implements java.io.Serializable
[[
" or "]]
") will be
replaced with single opening or closing square brackets to distinguish
them from the square brackets used in numeric ranges or URL
references.x
' character followed by a numeric value to be
used as the increment, an optional '%
' character followed
by a format string as allowed by the DecimalFormat
class to define how the resulting value should be formatted, and a
closing square bracket to indicate the end of the range.%
' character followed by a format string as
allowed by the DecimalFormat
class to define how the
resulting value should be formatted, and a closing square bracket to
indicate the end of the range.long
values. In a sequential numeric
range, if the first value is larger than the second value, then values will
be chosen in descending rather than ascending order (and if an increment is
given, then it should be positive). In addition, once the end of a
sequential range has been reached, then the value will wrap around to the
beginning of that range.
Hello
-- The static text "Hello
".[[Hello]]
-- The static text "[Hello]
" (note
that the double square brackets were replaced with single square
brackets).[0:1000]
-- A sequential numeric range that will iterate
in ascending sequential order from 0 to 1000. The 1002nd value that is
requested will cause the value to be wrapped around to 0 again.[1000:0]
-- A sequential numeric range that will iterate
in descending sequential order from 1000 to 0. The 1002nd value that is
requested will cause the value to be wrapped around to 1000 again.[0:1000x5%0000]
-- A sequential numeric range that will
iterate in ascending sequential order from 0 to 1000 in increments of
five with all values represented as four-digit numbers padded with
leading zeroes. For example, the first four values generated by this
component will be "0000", "0005", "0010", and "0015".[0-1000]
-- A random numeric range that will choose values
at random between 0 and 1000, inclusive.[0-1000%0000]
-- A random numeric range that will choose
values at random between 0 and 1000, inclusive, and values will be
padded with leading zeroes as necessary so that they are represented
using four digits.[file:///tmp/mydata.txt]
-- A URL reference that will
cause randomly-selected lines from the specified local file to be used
in place of the bracketed range.[http://server.example.com/tmp/mydata.txt]
-- A URL
reference that will cause randomly-selected lines from the specified
remote HTTP-accessible file to be used in place of the bracketed
range.dc=example,dc=com
-- A value pattern containing only
static text and no numeric components.[1000:9999]
-- A value pattern containing only a numeric
component that will choose numbers in sequential order from 1000 to
9999.(uid=user.[1-1000000])
-- A value pattern that combines
the static text "(uid=user.
" with a value chosen randomly
between one and one million, and another static text string of
")
".uid=user.[1-1000000],ou=org[1-10],dc=example,dc=com
-- A
value pattern containing two numeric components interspersed between
three static text components.uid=user.[1-1000000],ou=org[ref:1],dc=example,dc=com
-- A
value pattern in which the organization number will be the same as the
randomly-selected user number.Constructor and Description |
---|
ValuePattern(java.lang.String s)
Creates a new value pattern from the provided string.
|
ValuePattern(java.lang.String s,
java.lang.Long r)
Creates a new value pattern from the provided string.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
nextValue()
Retrieves the next value generated from the value pattern.
|
java.lang.String |
toString()
Retrieves a string representation of this value pattern, which will be the
original pattern string used to create it.
|
public ValuePattern(java.lang.String s) throws java.text.ParseException
s
- The string representation of the value pattern to create. It
must not be null
.java.text.ParseException
- If the provided string cannot be parsed as a valid
value pattern string.public ValuePattern(java.lang.String s, java.lang.Long r) throws java.text.ParseException
s
- The string representation of the value pattern to create. It
must not be null
.r
- The seed to use for the random number generator. It may be
null
if no seed is required.java.text.ParseException
- If the provided string cannot be parsed as a valid
value pattern string.public java.lang.String nextValue()
public java.lang.String toString()
toString
in class java.lang.Object