South African Generators
| Generator | Description | Examples |
|---|---|---|
| SouthAfricaCityGen | Generates the name of South African cities. | Fraserburg, Ashton, Tom Burke |
| SouthAfricaPostalCodeGen | Generates the postal code for South African cities. | 8001, 7380, 2680 |
| SouthAfricaProvinceGen | Generates the name of South African provinces. | Limpopo, KwaZulo-Natal, Mpumalanga |
| SouthAfricaProvinceCodeGen | Generates the code of South African provinces. | LP, KZN, MP |
| SouthAftricaDialingCodeGen | Generates the dialing code for South African cities. | 013, 014, 053 |
| SouthAfricaIdNumberGen | Generates structurally valid 13-digit South African Identity Numbers |
9510155137085 8803040426081 2007125984180 |
| SouthAfricaPhoneNumberGen | Randomly generates valid South African phone numbers in accordance with the South African National Numbering Plan. |
082 145 9032 011 476 5218 021 983 4470 |
Auto-Reference Generators
- SouthAfricaCityGen
- SouthAfricaPostalGen
- SouthAfricaProviceGen
- SouthAfricaProvinceCodeGen
- SouthAfricaDialingCodeGen
- SouthAfricaPhoneNumberGen

Auto-Reference Example
A user creates a Domain that contains two Attributes:
-
province - assigned the SouthAfricaProvinceGen.
- sortOrder = ALPHABETICAL
- autoReference = false
-
city - assigned the SouthAfricaCityGen
- sortOrder = RANDOM
- autoReference = true


SouthAfricaPhoneNumberGen
Randomly generates valid South African phone numbers in accordance with the South African National Numbering Plan.
Generator Parameters
This Generator has additional parameters that can be set up. Items with an asterisk* are required:
-
phoneType* - Defines which type of phone number should be generated. The choices are:
- Mobile - uses a mobile prefix allocated by ICASA.
- FixedLine - uses a geographic dialing code.
-
All - combines both the Mobile and FixedLine types.
-
format* - Defines the format used with the phone number. The choices are:
- National - the number carries the leading trunk 0, for example 082 145 9032
-
International - the trunk 0 is replaced by the +27 country code, for example +27 82 145 9032
-
includeFormatting* - When True, spaces are inserted between the number groups, for example 082 145 9032. When False, only digits are returned, for example 0821459032.
-
autoReference - see previous section for explanation.
- seed - Defines an optional seed for randomization. Using a seed ensures the same random data is generated each time.
Example Configuration
All default values are being used for this example:

Sample Output

SouthAfricaIdNumberGen
Generates structurally valid 13-digit South African Identity Numbers. The South African Identity Number follows the structure YYMMDD GSSSS C A Z:
- YYMMDD - the date of birth
- GSSS - the gender/sequence number. 0000 through 4999 for a female and 5000 through 9999 for a male
- C - the citizenship status, 0 for a South African citizen and 1 for any other status
- A - the historical classification digit, normally 8 or 9
- Z - the check/control digit, calculated over the first twelve digits
The dateOfBirth, sex (gender), citizenshipStatus and sequenceNumber parameters may each reference another Domain Attribute, which keeps the identity number consistent with the rest of the generated person. Setting validateCheckDigit to ‘False’ appends a deliberately incorrect check digit so that identity number validation can be tested.
Generator Parameters
This Generator has additional parameters that can be set up. Items with an asterisk* are required:
-
dateOfBirth* - Defines the date of birth used for the first six digits of the identity number. The value may be a supplied date, for example 1995-10-15, or a reference to another Domain Attribute, for example #{com.acme.Person.dateOfBirth}. The value must match the dateOfBirthFormat parameter.
-
dateOfBirthFormat* - Defines the date format of the dateOfBirth value, for example yyyy-MM-dd or MM/dd/yyyy. The format must be a valid Java SimpleDateFormat pattern. The date of birth is always written into the identity number as yyMMdd regardless of this format.
-
gender* - Defines the gender that the sequence number is generated for. The choices are:
- Female - the sequence number falls within 0000 through 4999
-
Male - the sequence number falls within 5000 through 9999
The value may also reference another Domain Attribute, for example #{Person.gender}.
-
citizenshipStatus - Defines the citizenship status digit of the identity number. The choices are:
- South African - a South African citizen, which generates a 0
- Other - any other citizenship status, which generates a 1
-
Random - a citizenship status is selected at random
The value may also reference another Domain Attribute. When the parameter is not supplied, South African is used.
-
sequenceNumber - Defines the four-digit gender/sequence number. Use AUTO to randomly generate a sequence number within the range of the selected sex, or supply an explicit number that falls within that range, 0 through 4999 for a female and 5000 through 9999 for a male. The value may also reference another Domain Attribute. When the parameter is not supplied, AUTO is used.
-
classificationDigit - Defines the historical classification digit that occupies the twelfth position of the identity number. The value must be a single digit and is normally 8 or 9. The value may also reference another Domain Attribute. When the parameter is not supplied, 8 is used.
-
validateCheckDigit - When True, the correct check digit is appended, which produces an identity number that passes validation. When False, an incorrect check digit is appended so that identity number validation failures can be tested. When the parameter is not supplied, True is used.
- seed - Defines an optional seed for randomization. Using the seed will ensure that the same random data is generated each time data is generated.
Example Configuration
This example contains a Domain with two Attributes: dateOfBirth and idNumber.The dateOfBirth Attribute uses a FlexibleDateRangeGen to generate dates ranging from 1975-01-01 to 2025-01-01.

The idNumber Attribute has the SouthAfricaIdNumberGen. All other parameters have their default values.

Sample Output

Article Feedback: Was this helpful?
Give feedback