|
OpenAPI 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface AQRandomFactory
This interface provides a way to conveniently generate various random values.
An object implementing this interface is available via aqua.random alias.
Field Summary | |
---|---|
static String |
LANG_BRAZILIAN_PORTUGUESE
A language constant used by the nextString() methods. |
static String |
LANG_CHINESE
A language constant used by the nextString() methods. |
static String |
LANG_CZECH
A language constant used by the nextString() methods. |
static String |
LANG_DANISH
A language constant used by the nextString() methods. |
static String |
LANG_DUTCH
A language constant used by the nextString() methods. |
static String |
LANG_ENGLISH
A language constant used by the nextString() methods. |
static String |
LANG_FINNISH
A language constant used by the nextString() methods. |
static String |
LANG_FRENCH
A language constant used by the nextString() methods. |
static String |
LANG_GERMAN
A language constant used by the nextString() methods. |
static String |
LANG_GREEK
A language constant used by the nextString() methods. |
static String |
LANG_HINDI
A language constant used by the nextString() methods. |
static String |
LANG_ITALIAN
A language constant used by the nextString() methods. |
static String |
LANG_JAPANESE
A language constant used by the nextString() methods. |
static String |
LANG_KOREAN
A language constant used by the nextString() methods. |
static String |
LANG_NORWEGIAN
A language constant used by the nextString() methods. |
static String |
LANG_POLISH
A language constant used by the nextString() methods. |
static String |
LANG_PORTUGUESE
A language constant used by the nextString() methods. |
static String |
LANG_RUSSIAN
A language constant used by the nextString() methods. |
static String |
LANG_SIMPLIFIED_CHINESE
A language constant used by the nextString() methods. |
static String |
LANG_SPANISH
A language constant used by the nextString() methods. |
static String |
LANG_SWEDISH
A language constant used by the nextString() methods. |
static String |
LANG_TRADITIONAL_CHINESE
A language constant used by the nextString() methods. |
Method Summary | |
---|---|
AQRandomDataSet |
newRandomDataSet()
Creates a new empty random data set factory without any constraints defined. |
AQRandomDataSet |
newRandomDataSet(int rows,
String[] types,
AQRandomRange[] ranges)
Creates a new random data set factory with row, type and range constraints specified. |
AQRandomDataSet |
newRandomDataSet(int rows,
String[] types,
AQRandomRange[] ranges,
AQRandomVariation[] variations)
Creates a new random data set factory with row, type, range and variation constraints specified. |
AQRandomDataSet |
newRandomDataSetByType(int rows,
int columns,
String type,
AQRandomRange range)
Creates a new random data set factory with row, column, type and range constraints specified, all of columns will have the same column type. |
AQRandomDataSet |
newRandomDataSetByType(int rows,
int columns,
String type,
AQRandomRange range,
AQRandomVariation variation)
Creates a new random data set factory with row, column, type, range and variation constraints specified, all of columns will have the same column type. |
AQRandomDateRange |
newRandomDateRange()
Creates a new AQRandomDateRange factory with range set to 01/01/1900 and 12/31/2099. |
AQRandomDateRange |
newRandomDateRange(Date from,
Date to)
Creates a new AQRandomDateRange factory with the specified range. |
AQRandomDateVariation |
newRandomDateVariation()
Creates a new AQRandomDateVariation factory with variation range set to -12 hours and 12 hours. |
AQRandomDateVariation |
newRandomDateVariation(int years,
int months,
int days,
int hours,
int minutes,
int seconds)
Creates a new AQRandomDateVariation factory with variation range set to -delta and delta
where delta is the total time calculated from the specified years, months, days, hours, minutes and seconds. |
AQRandomDateVariation |
newRandomDateVariation(int minYears,
int minMonths,
int minDays,
int minHours,
int minMinutes,
int minSeconds,
int maxYears,
int maxMonths,
int maxDays,
int maxHours,
int maxMinutes,
int maxSeconds)
Creates a new AQRandomDateVariation factory with range of
year, month, day, hour, minute and second variations specified. |
AQRandomNumberRange |
newRandomNumberRange()
Creates a new AQRandomNumberRange factory with range set to allow all of possible double values. |
AQRandomNumberRange |
newRandomNumberRange(Number from,
Number to)
Creates a new AQRandomNumberRange factory with the specified variation range. |
AQRandomNumberVariation |
newRandomNumberVariation()
Creates a new AQRandomNumberVariation factory with variation range set between -60 and 60. |
AQRandomNumberVariation |
newRandomNumberVariation(Number delta)
Creates a new AQRandomNumberVariation factory with variation set between -delta and delta . |
AQRandomNumberVariation |
newRandomNumberVariation(Number min,
Number max)
Creates a new AQRandomNumberVariation factory with the specified range. |
AQRandomStringLength |
newRandomStringLength()
Creates a new AQRandomStringLength factory with range set between 0 and 16. |
AQRandomStringLength |
newRandomStringLength(int minLength,
int maxLength)
Creates a new AQRandomStringLength factory with the specified range. |
String |
nextAirportCode()
Returns a random airport code. |
String |
nextAirportName()
Returns a random airport name. |
String |
nextAreaCode()
Returns a random US area code. |
BigDecimal |
nextBigDecimal()
Returns a BigDecimal object initialized with a random 64-bit IEEE 754 double precision value. |
BigDecimal |
nextBigDecimal(int minPrecision,
int maxPrecision,
int minScale,
int maxScale)
Returns a BigDecimal object initialized with a random, non-negative value. |
BigDecimal |
nextBigDecimal(String minValue,
String maxValue)
Returns a random BigDecimal value in the specified range. |
BigInteger |
nextBigInteger()
Returns a BigInteger object initialized with a random 64 bit integer value. |
BigInteger |
nextBigInteger(String minValue,
String maxValue)
Returns a random BigInteger value in the specified range. |
boolean |
nextBoolean()
Returns a random boolean value, either true or false. |
String |
nextBrowserName()
Returns a random internet browser name. |
String |
nextCity()
Returns a random city name. |
String |
nextColorName()
Returns a random color name (in English). |
String |
nextCommodity()
Returns a random commodity name. |
String |
nextCompanyName()
Returns a random fictitious company name. |
String |
nextContinent()
Returns a random continent. |
String |
nextCountry()
Returns a random country. |
String |
nextCreditCardCVC()
Returns a random 3-digit credit card verification number. |
String |
nextCreditCardCVC(String cardNumber)
Returns a random 3- or 4-digit credit card verification number, depending on the type of card determined from the card number argument. |
String |
nextCreditCardNumber()
Returns a random fictitious credit card number compliant with Luhn check. |
String |
nextCreditCardType()
Returns a random credit card type. |
String |
nextCurrency()
Returns a random currency name. |
String |
nextCurrencyCode()
Returns a random currency code. |
Date |
nextDate()
Returns a random Date value in a range between January 1st, 1900 and December 31st, 2199. |
Date |
nextDate(Date startDate,
Date endDate)
Returns a random Date value in the specified range. |
String |
nextDayOfWeek()
Returns a random day of week in English, possible values are Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday. |
String |
nextDomain()
Returns a random fictitious domain name. |
double |
nextDouble()
Returns a random floating point value in 64-bit IEEE 754 format in a range between 4.94065645841246544e-324 and 1.79769313486231570e+308, inclusive. |
double |
nextDouble(double minValue,
double maxValue)
Returns a random floating point value in 64-bit IEEE 754 format in the range minValue..maxValue, inclusive. |
String |
nextEmailAddress()
Returns a random fictitious email address. |
String |
nextFirstName()
Returns a random first name. |
float |
nextFloat()
Returns a random floating point value in 32-bit IEEE 754 format in a range between 1.40129846432481707e-45 and 3.40282346638528860e+38, inclusive. |
float |
nextFloat(float minValue,
float maxValue)
Returns a random floating point value in 32-bit IEEE 754 format in the range minValue..maxValue, inclusive. |
String |
nextGender()
Returns a random gender name. |
String |
nextGUID()
Generates a 36 character globally unique random string. |
String |
nextHoliday()
Returns a random US holiday name. |
String |
nextHtmlColorHexCode()
Returns a random HTML hexadecimal color code in the range #000000 ... |
String |
nextHtmlColorName()
Returns a random HTML color name. |
String |
nextIndustry()
Returns a random industry name. |
Integer |
nextInteger()
Returns a random 32-bit integer in a range between -2,147,483,648 and 2,147,483,647, inclusive. |
Integer |
nextInteger(int minValue,
int maxValue)
Returns a random 32-bit integer in the range minValue..maxValue, inclusive. |
Object |
nextItemFromList(Object items)
Returns a random item from the list or array of objects passed as an argument. |
String |
nextLanguage()
Returns a random language name. |
String |
nextLastName()
Returns a random last name. |
String |
nextLocale()
Returns a random locale identifier. |
long |
nextLong()
Returns a random 64-bit integer in a range between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807, inclusive. |
long |
nextLong(Object minValue,
Object maxValue)
Returns a random 64-bit integer in the range minValue..maxValue, inclusive. |
String |
nextMonthOfYear()
Returns a random month name in English, possible values are January, February, March, April, May, June, July, August, September, October, November, December. |
String |
nextNameSuffix()
Returns a random name suffix. |
String |
nextOperatingSystem()
Returns a random operating system name. |
String |
nextPassword()
Returns a random password. |
String |
nextPhoneNumber()
Returns a random fictitious US phone number. |
String |
nextSalutation()
Returns a random salutation. |
short |
nextShort()
Returns a random 16-bit integer in a range between -32,768 and 32,767, inclusive. |
short |
nextShort(short minValue,
short maxValue)
Returns a random 16-bit integer in the range minValue..maxValue, inclusive. |
String |
nextSSN()
Returns a random fictitious US social security number. |
String |
nextState()
Returns a random US state. |
String |
nextStockCode()
Returns a random fictitious stock code. |
String |
nextStreet()
Returns a random street name. |
String |
nextString(int maxLength)
Returns a random English string up to maxLength characters long, including spaces. |
String |
nextString(int minLength,
int maxLength)
Returns a random English string between minLength and maxLength long (including spaces). |
String |
nextString(int minLength,
int maxLength,
String language)
Returns a random string between minLength and maxLength long, which contains characters from the specified language (including spaces). |
String |
nextString(int maxLength,
String language)
Returns a random string up to maxLength characters long, containing characters from the specified language, including spaces. |
String |
nextTimezone()
Returns a random time zone. |
String |
nextUnicodeString(int length)
Returns a random string up to maxLength characters long, containing characters from a wide range of unicode symbols, including spaces. |
String |
nextUnicodeString(int minLength,
int maxLength)
Returns a random string between minLength and maxLength long, which contains characters from a wide range of unicode symbols (including spaces). |
String |
nextYear()
Returns a random year in the range 1900..2199 |
String |
nextZipCode()
Returns a random fictitious US zip code. |
Field Detail |
---|
static final String LANG_BRAZILIAN_PORTUGUESE
nextString()
methods.
static final String LANG_CHINESE
nextString()
methods.
static final String LANG_CZECH
nextString()
methods.
static final String LANG_DANISH
nextString()
methods.
static final String LANG_DUTCH
nextString()
methods.
static final String LANG_ENGLISH
nextString()
methods.
static final String LANG_FINNISH
nextString()
methods.
static final String LANG_FRENCH
nextString()
methods.
static final String LANG_GERMAN
nextString()
methods.
static final String LANG_GREEK
nextString()
methods.
static final String LANG_HINDI
nextString()
methods.
static final String LANG_ITALIAN
nextString()
methods.
static final String LANG_JAPANESE
nextString()
methods.
static final String LANG_KOREAN
nextString()
methods.
static final String LANG_NORWEGIAN
nextString()
methods.
static final String LANG_POLISH
nextString()
methods.
static final String LANG_PORTUGUESE
nextString()
methods.
static final String LANG_RUSSIAN
nextString()
methods.
static final String LANG_SIMPLIFIED_CHINESE
nextString()
methods.
static final String LANG_SPANISH
nextString()
methods.
static final String LANG_SWEDISH
nextString()
methods.
static final String LANG_TRADITIONAL_CHINESE
nextString()
methods.
Method Detail |
---|
String nextString(int maxLength)
maxLength
- String maximum length.String nextString(int minLength, int maxLength)
minLength
- String minimum length.maxLength
- String maximum length.String nextString(int maxLength, String language)
maxLength
- String maximum length.language
- a language constant, please see CONSTANT definitions above for supported language codes;
English is used if null or an unsupported language is specified.String nextString(int minLength, int maxLength, String language)
minLength
- String minimum length.maxLength
- String maximum length.language
- a language constant, please see CONSTANT definitions above for supported language codes;
English is used if null or an unsupported language is specified.String nextUnicodeString(int length)
length
- String maximum length.String nextUnicodeString(int minLength, int maxLength)
minLength
- String minimum length.maxLength
- String maximum length.short nextShort()
short nextShort(short minValue, short maxValue)
minValue
- the lower bound.maxValue
- the upper bound.Integer nextInteger()
Integer nextInteger(int minValue, int maxValue)
minValue
- the lower bound.maxValue
- the upper bound.long nextLong()
long nextLong(Object minValue, Object maxValue)
Long
, or a String
.
A javascript number is represented internally by a double value, and as such it cannot represent
the full range of long values exactly. The java IEEE 754
double precision number with a 52 bit significand
can represent integer values in the range of +/-(252 - 1) (-9,007,199,254,740,991 ... +9,007,199,254,740,991).
This method will throw an exception if the modulus of any argument passed in the form of a javascript number
lies outside of this range.
Alternatively, a long value can be passed in the form of a Long
object, or its decimal
representation in a form of a String
.
Example:var randomLong = aqua.random.nextLong('-9223372036854775808', '9223372036854775807');
minValue
- the lower bound.maxValue
- the upper bound.float nextFloat()
float nextFloat(float minValue, float maxValue)
minValue
- the lower bound.maxValue
- the upper bound.double nextDouble()
double nextDouble(double minValue, double maxValue)
minValue
- the lower bound.maxValue
- the upper bound.BigInteger nextBigInteger()
BigInteger
object initialized with a random 64 bit integer value.
BigInteger nextBigInteger(String minValue, String maxValue)
BigInteger
value in the specified range.
minValue
- Numeric value of the lower bound, inclusive.maxValue
- Numeric value of the upper bound, inclusive.BigDecimal nextBigDecimal()
BigDecimal
object initialized with a random 64-bit IEEE 754 double precision value.
The value returned will be between 0 (inclusive) and 1 (exclusive).
BigDecimal nextBigDecimal(int minPrecision, int maxPrecision, int minScale, int maxScale)
BigDecimal
object initialized with a random, non-negative value.
The scale and precision of the returning value falls within range determined by the method arguments.
minPrecision
- Minimum of the precision range (must be greater than 0)maxPrecision
- Maximum of the precision range (must be greater or equal than minPrecision)minScale
- Minimum of the scale range (must be greater or equal to 0)maxScale
- Maximum of the scale range (must be greater or equal than minScale)BigDecimal nextBigDecimal(String minValue, String maxValue)
BigDecimal
value in the specified range.
minValue
- Numeric value of the lower bound (inclusive).maxValue
- Numeric value of the upper bound (exclusive).boolean nextBoolean()
Date nextDate()
Date
value in a range between January 1st, 1900 and December 31st, 2199.
Date nextDate(Date startDate, Date endDate)
Date
value in the specified range.
startDate
- The starting date, inclusive.endDate
- The ending date, inclusive.String nextDayOfWeek()
Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday.
String nextMonthOfYear()
January, February, March, April, May, June, July, August, September, October, November, December.
String nextYear()
String nextFirstName()
String nextLastName()
String nextStreet()
String nextCity()
String nextState()
String nextCountry()
String nextDomain()
String nextEmailAddress()
String nextPassword()
String nextTimezone()
String nextLocale()
Object nextItemFromList(Object items)
List
instance. An exception will be thrown for any other argument type.
items
- Data source.String nextCreditCardNumber()
String nextCreditCardCVC()
String nextCreditCardCVC(String cardNumber)
cardNumber
- Credit card number (digits only, no dashes or spaces).String nextCreditCardType()
String nextCurrencyCode()
String nextCurrency()
String nextStockCode()
String nextContinent()
String nextAreaCode()
String nextZipCode()
String nextPhoneNumber()
String nextLanguage()
String nextHtmlColorHexCode()
String nextHtmlColorName()
String nextColorName()
String nextBrowserName()
String nextSSN()
String nextAirportName()
String nextAirportCode()
String nextSalutation()
String nextNameSuffix()
String nextGender()
String nextOperatingSystem()
String nextIndustry()
String nextCommodity()
String nextHoliday()
String nextCompanyName()
String nextGUID()
AQRandomDataSet newRandomDataSet()
AQRandomDataSet
to define required constraints before generating a random data set.
AQRandomDataSet newRandomDataSet(int rows, String[] types, AQRandomRange[] ranges)
AQRandomDataSet
for supported types and ranges.
rows
- number of rows to generatetypes
- the column typesranges
- the range constraint to be applied to the generated data, one for each columnAQRandomDataSet newRandomDataSet(int rows, String[] types, AQRandomRange[] ranges, AQRandomVariation[] variations)
AQRandomDataSet
for supported types, ranges and variations.
rows
- number of rows to generatetypes
- the column typesranges
- the range constraint to be applied to the generated data, one for each columnvariations
- the variation constraint to be applied to the generated data, one for each columnAQRandomDataSet newRandomDataSetByType(int rows, int columns, String type, AQRandomRange range)
AQRandomDataSet
for supported types and ranges.
rows
- number of rows to generatecolumns
- number of columns to generatetype
- the column typerange
- the range constraint to be applied to the generated dataAQRandomDataSet newRandomDataSetByType(int rows, int columns, String type, AQRandomRange range, AQRandomVariation variation)
AQRandomDataSet
for supported types and ranges.
rows
- number of rows to generatecolumns
- number of columns to generatetype
- the column typerange
- the range constraint to be applied to the generated datavariation
- the variation constraint to be applied to the generated dataAQRandomDateRange newRandomDateRange()
AQRandomDateRange
factory with range set to 01/01/1900 and 12/31/2099.
AQRandomDateRange newRandomDateRange(Date from, Date to)
AQRandomDateRange
factory with the specified range.
from
- the begin date of the range, 01/01/1900 is used if nullto
- the end date of the range, 12/31/2099 is used if nullAQRandomDateVariation newRandomDateVariation()
AQRandomDateVariation
factory with variation range set to -12 hours and 12 hours.
AQRandomDateVariation newRandomDateVariation(int years, int months, int days, int hours, int minutes, int seconds)
AQRandomDateVariation
factory with variation range set to -delta
and delta
where delta is the total time calculated from the specified years, months, days, hours, minutes and seconds.
AQRandomDateVariation newRandomDateVariation(int minYears, int minMonths, int minDays, int minHours, int minMinutes, int minSeconds, int maxYears, int maxMonths, int maxDays, int maxHours, int maxMinutes, int maxSeconds)
AQRandomDateVariation
factory with range of
year, month, day, hour, minute and second variations specified.
AQRandomNumberRange newRandomNumberRange()
AQRandomNumberRange
factory with range set to allow all of possible double values.
AQRandomNumberRange newRandomNumberRange(Number from, Number to)
AQRandomNumberRange
factory with the specified variation range.
from
- the minimum value allowed, the smallest value of type double is used if nullto
- the maximum value allowed, the largest value of type double is used if nullAQRandomNumberVariation newRandomNumberVariation()
AQRandomNumberVariation
factory with variation range set between -60 and 60.
AQRandomNumberVariation newRandomNumberVariation(Number delta)
AQRandomNumberVariation
factory with variation set between -delta
and delta
.
delta
- the variation delta, default delta (60) is used if nullAQRandomNumberVariation newRandomNumberVariation(Number min, Number max)
AQRandomNumberVariation
factory with the specified range.
min
- the minimum value allowed,
if null the result of this method would be the same as calling newRandomNumberVariation(max)
max
- the maximum value allowed,
if null the result of this method would be the same as calling newRandomNumberVariation(min)
AQRandomStringLength newRandomStringLength()
AQRandomStringLength
factory with range set between 0 and 16.
AQRandomStringLength newRandomStringLength(int minLength, int maxLength)
AQRandomStringLength
factory with the specified range.
minLength
- the minimum length allowed, negative value indicates generation of null object is allowedmaxLength
- the maximum length allowed, negative value indicates generation of null object is allowed
|
OpenAPI 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |