feat: add barcode fake data generator

This commit is contained in:
manudevelopia
2019-03-03 18:22:17 +01:00
parent b18526f360
commit 6b2e98a56d
4 changed files with 37 additions and 0 deletions
@@ -0,0 +1,22 @@
package com.github.javafaker;
public class Barcode {
private Faker faker;
public Barcode(Faker faker) {
this.faker = faker;
}
public String type() {
return faker.resolve("barcode.types");
}
public String data(){
return faker.resolve("barcode.datas");
}
public String typeAndData(){
return faker.resolve("barcode.typeAndData");
}
}
@@ -84,6 +84,7 @@ public class Faker {
private final Weather weather;
private final Lebowski lebowski;
private final Medical medical;
private final Barcode barcode;
public Faker() {
this(Locale.ENGLISH);
@@ -169,6 +170,7 @@ public class Faker {
this.lebowski = new Lebowski(this);
this.medical = new Medical(this);
this.country = new Country(this);
this.barcode = new Barcode(this);
}
/**
@@ -557,6 +559,8 @@ public class Faker {
public Country country(){ return country;}
public Barcode barcode(){ return barcode;}
public String resolve(String key) {
return this.fakeValuesService.resolve(key, this, this);
}
@@ -12,6 +12,7 @@ public class En {
"aqua_teen_hunger_force.yml",
"artist.yml",
"back_to_the_future.yml",
"barcode.yml",
"bank.yml",
"beer.yml",
"bojack_horseman.yml",
+10
View File
@@ -0,0 +1,10 @@
en:
faker:
barcode:
types: ['UPC', 'UPC-A', 'UPC-E', 'Code128', 'Code39','Code93', 'EAN', 'EAN-13', 'EAN-8', 'JAN-13', 'ISBN', 'ISSN',
'ITF', 'Codabar', 'Ames Code', 'NW-7', 'Monarch', 'Code 2 of 7', 'Rationalized', 'ANSI/AIM BC3-1995', 'USD-4',
'GS1 Databar', 'MSI Plessey', 'UCC']
datas: ['12345678', '09876543', '05755069', '15008444', '69503172', '05082366', '29951287', '37457367',
'87164772', '17217165', '56462327', '35186895', '16957481', '68124245', '28664694', '12372549',
'02527355']
typeAndData: "#{barcode.types} #{barcode.datas}"