com.unboundid.util
Class ValuePattern

java.lang.Object
  extended by com.unboundid.util.ValuePattern
All Implemented Interfaces:
java.io.Serializable

@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class ValuePattern
extends java.lang.Object
implements java.io.Serializable

This class provides a method for generating a string value comprised of zero or more components. The components may be any combination of zero or more strings, sequential numeric ranges, and random numeric ranges. These components should be formatted as follows:


It must be possible to represent all of the numeric values used in sequential or random numeric ranges as 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.
Examples of value pattern components include:
Examples of full value pattern strings include:

See Also:
Serialized Form

Field Summary
static java.lang.String PUBLIC_JAVADOC_URL
          The URL to the publicly-accessible javadoc for this class, which provides a detailed overview of the supported value pattern syntax.
 
Constructor Summary
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.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PUBLIC_JAVADOC_URL

public static final java.lang.String PUBLIC_JAVADOC_URL
The URL to the publicly-accessible javadoc for this class, which provides a detailed overview of the supported value pattern syntax.

See Also:
Constant Field Values
Constructor Detail

ValuePattern

public ValuePattern(java.lang.String s)
             throws java.text.ParseException
Creates a new value pattern from the provided string.

Parameters:
s - The string representation of the value pattern to create. It must not be null.
Throws:
java.text.ParseException - If the provided string cannot be parsed as a valid value pattern string.

ValuePattern

public ValuePattern(java.lang.String s,
                    java.lang.Long r)
             throws java.text.ParseException
Creates a new value pattern from the provided string.

Parameters:
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.
Throws:
java.text.ParseException - If the provided string cannot be parsed as a valid value pattern string.
Method Detail

nextValue

public java.lang.String nextValue()
Retrieves the next value generated from the value pattern.

Returns:
The next value generated from the value pattern.

toString

public java.lang.String toString()
Retrieves a string representation of this value pattern, which will be the original pattern string used to create it.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this value pattern.