-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from EduardRindt-4F/locale-ge
Add locale for GE
- Loading branch information
Showing
22 changed files
with
511 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.codearte.jfairy; | ||
|
||
import io.codearte.jfairy.data.DataMaster; | ||
import io.codearte.jfairy.producer.RandomGenerator; | ||
import io.codearte.jfairy.producer.VATIdentificationNumberProvider; | ||
import io.codearte.jfairy.producer.company.locale.ka.KaVATIdentificationNumberProvider; | ||
import io.codearte.jfairy.producer.person.AddressProvider; | ||
import io.codearte.jfairy.producer.person.NationalIdentificationNumberFactory; | ||
import io.codearte.jfairy.producer.person.NationalIdentityCardNumberProvider; | ||
import io.codearte.jfairy.producer.person.PassportNumberProvider; | ||
import io.codearte.jfairy.producer.person.locale.NoNationalIdentificationNumberFactory; | ||
import io.codearte.jfairy.producer.person.locale.ka.KaAddressProvider; | ||
import io.codearte.jfairy.producer.person.locale.ka.KaNationalIdentityCardNumberProvider; | ||
import io.codearte.jfairy.producer.person.locale.ka.KaPassportNumberProvider; | ||
|
||
public class KaFairyModule extends FairyModule { | ||
|
||
public KaFairyModule(DataMaster dataMaster, RandomGenerator randomGenerator) { | ||
super(dataMaster, randomGenerator); | ||
} | ||
|
||
@Override | ||
protected void configure() { | ||
super.configure(); | ||
bind(NationalIdentificationNumberFactory.class).to(NoNationalIdentificationNumberFactory.class); | ||
bind(NationalIdentityCardNumberProvider.class).to(KaNationalIdentityCardNumberProvider.class); | ||
bind(VATIdentificationNumberProvider.class).to(KaVATIdentificationNumberProvider.class); | ||
bind(AddressProvider.class).to(KaAddressProvider.class); | ||
bind(PassportNumberProvider.class).to(KaPassportNumberProvider.class); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...java/io/codearte/jfairy/producer/company/locale/ka/KaVATIdentificationNumberProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.codearte.jfairy.producer.company.locale.ka; | ||
|
||
import com.google.inject.Inject; | ||
import io.codearte.jfairy.producer.BaseProducer; | ||
import io.codearte.jfairy.producer.VATIdentificationNumberProvider; | ||
|
||
public class KaVATIdentificationNumberProvider implements VATIdentificationNumberProvider { | ||
|
||
private final BaseProducer baseProducer; | ||
|
||
@Inject | ||
public KaVATIdentificationNumberProvider(BaseProducer baseProducer) { | ||
this.baseProducer = baseProducer; | ||
} | ||
|
||
@Override | ||
public String get() { | ||
return baseProducer.randomElement("2", "4") + baseProducer.numerify("########"); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
src/main/java/io/codearte/jfairy/producer/person/locale/AbstractAddress.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package io.codearte.jfairy.producer.person.locale; | ||
|
||
import io.codearte.jfairy.producer.person.Address; | ||
|
||
/** | ||
* A base of all addresses. It carries all needed fields, but leaves most of formatting to subclasses. | ||
*/ | ||
public abstract class AbstractAddress implements Address { | ||
protected final String street; | ||
protected final String streetNumber; | ||
protected final String apartmentNumber; | ||
protected final String postalCode; | ||
protected final String city; | ||
|
||
public AbstractAddress(String street, String streetNumber, String apartmentNumber, String postalCode, String city) { | ||
this.street = street; | ||
this.streetNumber = streetNumber; | ||
this.postalCode = postalCode; | ||
this.city = city; | ||
this.apartmentNumber = apartmentNumber; | ||
} | ||
|
||
public String getStreet() { | ||
return street; | ||
} | ||
|
||
public String getStreetNumber() { | ||
return streetNumber; | ||
} | ||
|
||
public String getApartmentNumber() { | ||
return apartmentNumber; | ||
} | ||
|
||
public String getPostalCode() { | ||
return postalCode; | ||
} | ||
|
||
public String getCity() { | ||
return city; | ||
} | ||
|
||
public abstract String getAddressLine1(); | ||
|
||
public abstract String getAddressLine2(); | ||
|
||
@Override | ||
public String toString() { | ||
return getAddressLine1() + System.lineSeparator() + getAddressLine2(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/io/codearte/jfairy/producer/person/locale/ContinentalAddress.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.codearte.jfairy.producer.person.locale; | ||
|
||
import static org.apache.commons.lang3.StringUtils.isNotBlank; | ||
|
||
/** | ||
* An address format typical for European countries but the UK and ex-Soviet union. | ||
*/ | ||
public abstract class ContinentalAddress extends AbstractAddress { | ||
public ContinentalAddress(String street, String streetNumber, String apartmentNumber, String postalCode, String city) { | ||
super(street, streetNumber, apartmentNumber, postalCode, city); | ||
} | ||
|
||
protected abstract String getApartmentMark(); | ||
|
||
protected String getStreetNumberSeparator() { | ||
return " "; | ||
} | ||
|
||
@Override | ||
public String getAddressLine1() { | ||
return street + getStreetNumberSeparator() + streetNumber | ||
+ (isNotBlank(apartmentNumber) ? getApartmentMark() + apartmentNumber : ""); | ||
} | ||
|
||
@Override | ||
public String getAddressLine2() { | ||
return postalCode + " " + city; | ||
} | ||
} |
53 changes: 5 additions & 48 deletions
53
src/main/java/io/codearte/jfairy/producer/person/locale/de/DeAddress.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,22 @@ | ||
package io.codearte.jfairy.producer.person.locale.de; | ||
|
||
import io.codearte.jfairy.producer.person.Address; | ||
import io.codearte.jfairy.producer.person.locale.ContinentalAddress; | ||
|
||
import static org.apache.commons.lang3.StringUtils.isNotBlank; | ||
import static org.apache.commons.lang3.SystemUtils.LINE_SEPARATOR; | ||
|
||
/** | ||
* @author Roland Weisleder | ||
*/ | ||
public class DeAddress implements Address { | ||
|
||
private final String streetNumber; | ||
|
||
private final String street; | ||
|
||
private final String apartmentNumber; | ||
|
||
private final String city; | ||
|
||
private final String postalCode; | ||
public class DeAddress extends ContinentalAddress { | ||
|
||
public DeAddress(String streetNumber, String street, String apartmentNumber, String city, String postalCode) { | ||
this.streetNumber = streetNumber; | ||
this.street = street; | ||
this.apartmentNumber = apartmentNumber; | ||
this.city = city; | ||
this.postalCode = postalCode; | ||
} | ||
|
||
public String getStreetNumber() { | ||
return streetNumber; | ||
} | ||
|
||
public String getStreet() { | ||
return street; | ||
} | ||
|
||
public String getApartmentNumber() { | ||
return apartmentNumber; | ||
} | ||
|
||
public String getCity() { | ||
return city; | ||
} | ||
|
||
public String getPostalCode() { | ||
return postalCode; | ||
} | ||
|
||
public String getAddressLine1() { | ||
return street + " " + streetNumber | ||
+ (isNotBlank(apartmentNumber) ? ", " + apartmentNumber : ""); | ||
} | ||
|
||
public String getAddressLine2() { | ||
return postalCode + " " + city; | ||
super(street, streetNumber, apartmentNumber, postalCode, city); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getAddressLine1() + LINE_SEPARATOR + getAddressLine2(); | ||
protected String getApartmentMark() { | ||
return ", "; | ||
} | ||
|
||
} |
46 changes: 5 additions & 41 deletions
46
src/main/java/io/codearte/jfairy/producer/person/locale/en/EnAddress.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,25 @@ | ||
package io.codearte.jfairy.producer.person.locale.en; | ||
|
||
import io.codearte.jfairy.producer.person.Address; | ||
import io.codearte.jfairy.producer.person.locale.AbstractAddress; | ||
|
||
import static org.apache.commons.lang3.StringUtils.isNotBlank; | ||
import static org.apache.commons.lang3.SystemUtils.LINE_SEPARATOR; | ||
|
||
public class EnAddress implements Address { | ||
|
||
private final String streetNumber; | ||
|
||
private final String street; | ||
|
||
private final String apartmentNumber; | ||
|
||
private final String city; | ||
|
||
private final String postalCode; | ||
public class EnAddress extends AbstractAddress { | ||
|
||
public EnAddress(String streetNumber, String street, String apartmentNumber, String city, String postalCode) { | ||
this.streetNumber = streetNumber; | ||
this.street = street; | ||
this.apartmentNumber = apartmentNumber; | ||
this.city = city; | ||
this.postalCode = postalCode; | ||
} | ||
|
||
public String getStreetNumber() { | ||
return streetNumber; | ||
} | ||
|
||
public String getStreet() { | ||
return street; | ||
} | ||
|
||
public String getApartmentNumber() { | ||
return apartmentNumber; | ||
} | ||
|
||
public String getCity() { | ||
return city; | ||
} | ||
|
||
public String getPostalCode() { | ||
return postalCode; | ||
super(street, streetNumber, apartmentNumber, postalCode, city); | ||
} | ||
|
||
@Override | ||
public String getAddressLine1() { | ||
return streetNumber + " " + street | ||
+ (isNotBlank(apartmentNumber) ? " APT " + apartmentNumber : ""); | ||
} | ||
|
||
@Override | ||
public String getAddressLine2() { | ||
return city + " " + postalCode; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getAddressLine1() + LINE_SEPARATOR + getAddressLine2(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/io/codearte/jfairy/producer/person/locale/ka/KaAddress.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.codearte.jfairy.producer.person.locale.ka; | ||
|
||
import io.codearte.jfairy.producer.person.locale.AbstractAddress; | ||
|
||
import static org.apache.commons.lang3.StringUtils.isNotBlank; | ||
|
||
public class KaAddress extends AbstractAddress { | ||
public KaAddress(String street, String streetNumber, String apartmentNumber, String postalCode, String city) { | ||
super(street, streetNumber, apartmentNumber, postalCode, city); | ||
} | ||
|
||
@Override | ||
public String getAddressLine1() { | ||
return postalCode + ", " + city; | ||
} | ||
|
||
@Override | ||
public String getAddressLine2() { | ||
return street + " №" + streetNumber + (isNotBlank(apartmentNumber) ? ", ბინა " + apartmentNumber : ""); | ||
} | ||
} |
Oops, something went wrong.