Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package routines;
- import java.util.Locale;
- import com.github.javafaker.Faker;
- /*
- * user specification: the function's comment should contain keys as follows: 1. write about the function's comment.but
- * it must be before the "{talendTypes}" key.
- *
- * 2. {talendTypes} 's value must be talend Type, it is required . its value should be one of: String, char | Character,
- * long | Long, int | Integer, boolean | Boolean, byte | Byte, Date, double | Double, float | Float, Object, short |
- * Short
- *
- * 3. {Category} define a category for the Function. it is required. its value is user-defined .
- *
- * 4. {param} 's format is: {param} <type>[(<default value or closed list values>)] <name>[ : <comment>]
- *
- * <type> 's value should be one of: string, int, list, double, object, boolean, long, char, date. <name>'s value is the
- * Function's parameter name. the {param} is optional. so if you the Function without the parameters. the {param} don't
- * added. you can have many parameters for the Function.
- *
- * 5. {example} gives a example for the Function. it is optional.
- */
- public class FakerDataGenerator {
- private static Locale internalLocale = new Locale("fr");
- private static Faker internalFaker = getFaker();
- private static Faker getFaker() {
- Faker faker = new Faker(internalLocale);
- return faker;
- }
- /**
- * {talendTypes} String
- *
- * {Category} FakerDataGenerator
- *
- * {example} getFirstName() # Bill.
- */
- public static String getFirstName() {
- return internalFaker.name().firstName();
- }
- /**
- * {talendTypes} String
- *
- * {Category} FakerDataGenerator
- *
- * {example} getLastName() # Washington.
- */
- public static String getLastName() {
- return internalFaker.name().lastName();
- }
- /**
- * {talendTypes} String
- *
- * {Category} FakerDataGenerator
- *
- * {example} getCity() # Paris.
- */
- public static String getCity() {
- return internalFaker.address().city();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment