Guest User

Untitled

a guest
Apr 26th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. package routines;
  2.  
  3. import java.util.Locale;
  4. import com.github.javafaker.Faker;
  5.  
  6. /*
  7. * user specification: the function's comment should contain keys as follows: 1. write about the function's comment.but
  8. * it must be before the "{talendTypes}" key.
  9. *
  10. * 2. {talendTypes} 's value must be talend Type, it is required . its value should be one of: String, char | Character,
  11. * long | Long, int | Integer, boolean | Boolean, byte | Byte, Date, double | Double, float | Float, Object, short |
  12. * Short
  13. *
  14. * 3. {Category} define a category for the Function. it is required. its value is user-defined .
  15. *
  16. * 4. {param} 's format is: {param} <type>[(<default value or closed list values>)] <name>[ : <comment>]
  17. *
  18. * <type> 's value should be one of: string, int, list, double, object, boolean, long, char, date. <name>'s value is the
  19. * Function's parameter name. the {param} is optional. so if you the Function without the parameters. the {param} don't
  20. * added. you can have many parameters for the Function.
  21. *
  22. * 5. {example} gives a example for the Function. it is optional.
  23. */
  24. public class FakerDataGenerator {
  25. private static Locale internalLocale = new Locale("fr");
  26. private static Faker internalFaker = getFaker();
  27. private static Faker getFaker() {
  28. Faker faker = new Faker(internalLocale);
  29. return faker;
  30. }
  31. /**
  32. * {talendTypes} String
  33. *
  34. * {Category} FakerDataGenerator
  35. *
  36. * {example} getFirstName() # Bill.
  37. */
  38. public static String getFirstName() {
  39. return internalFaker.name().firstName();
  40. }
  41. /**
  42. * {talendTypes} String
  43. *
  44. * {Category} FakerDataGenerator
  45. *
  46. * {example} getLastName() # Washington.
  47. */
  48. public static String getLastName() {
  49. return internalFaker.name().lastName();
  50. }
  51.  
  52. /**
  53. * {talendTypes} String
  54. *
  55. * {Category} FakerDataGenerator
  56. *
  57. * {example} getCity() # Paris.
  58. */
  59. public static String getCity() {
  60. return internalFaker.address().city();
  61. }
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment