public final class StringSequenceValueGenerator extends java.lang.Object implements ValueGenerator<java.lang.String>
ValueGenerator
that returns a string prefix followed by a sequence number, optionally left-padded
with 0 to ensure a correct ordering (for example: CODE_001, CODE_002, etc.). Instances of this generator
are created by ValueGenerators.stringSequence(String)
.Modifier and Type | Method and Description |
---|---|
StringSequenceValueGenerator |
incrementingBy(int increment)
Increments the number by the given increment.
|
java.lang.String |
nextValue()
Called each time a new row is inserted, to get the value to insert in the column using this value generator.
|
StringSequenceValueGenerator |
startingAt(long start)
Restarts the sequence at the given value
|
java.lang.String |
toString() |
StringSequenceValueGenerator |
withLeftPadding(int paddedNumberLength)
Tells the generator to left-pad the number it generates with 0 until the length of the number is the given
length.
|
StringSequenceValueGenerator |
withoutLeftPadding()
Tells the generator to avoid left-padding the number it generates with 0
|
public StringSequenceValueGenerator withLeftPadding(int paddedNumberLength)
paddedNumberLength
- the length of the number once padded. Must be > 0.public StringSequenceValueGenerator withoutLeftPadding()
public StringSequenceValueGenerator startingAt(long start)
start
- the new starting value of the sequencepublic StringSequenceValueGenerator incrementingBy(int increment)
public java.lang.String nextValue()
ValueGenerator
nextValue
in interface ValueGenerator<java.lang.String>
public java.lang.String toString()
toString
in class java.lang.Object