-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added street, street no. and apartement no. in EN and PL versions to be generated in the addresssss. Localised address string. Added interface and implementation to provide localised address strings. Import fix.
- Loading branch information
1 parent
3689cb6
commit bb5cdc3
Showing
10 changed files
with
167 additions
and
31 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
14 changes: 14 additions & 0 deletions
14
src/main/java/eu/codearte/jfairy/producer/person/AddressStringProvider.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,14 @@ | ||
package eu.codearte.jfairy.producer.person; | ||
|
||
import javax.inject.Singleton; | ||
|
||
/** | ||
* @author omaciaszek | ||
* @since 15.02.15 | ||
*/ | ||
@Singleton | ||
public interface AddressStringProvider { | ||
|
||
String addressString(Address address); | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/eu/codearte/jfairy/producer/person/locale/en/EnAddressStringProvider.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,27 @@ | ||
package eu.codearte.jfairy.producer.person.locale.en; | ||
|
||
import eu.codearte.jfairy.producer.person.Address; | ||
import eu.codearte.jfairy.producer.person.AddressStringProvider; | ||
|
||
/** | ||
* @author omaciaszek | ||
* @since 15.02.15 | ||
*/ | ||
public class EnAddressStringProvider implements AddressStringProvider { | ||
|
||
@Override | ||
public String addressString(Address address) { | ||
return address.streetNumber() + " " + address.street() + " Str." + apartmentString(address) | ||
+ ", " + address.getPostalCode() + " " + address.getCity(); | ||
} | ||
|
||
private String apartmentString(Address address) { | ||
String apartmentString; | ||
if (address.apartmentNumber().equals("")) { | ||
apartmentString = ""; | ||
} else { | ||
apartmentString = " No. " + address.apartmentNumber(); | ||
} | ||
return apartmentString; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/eu/codearte/jfairy/producer/person/locale/pl/PlAddressStringProvider.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 eu.codearte.jfairy.producer.person.locale.pl; | ||
|
||
import eu.codearte.jfairy.producer.person.Address; | ||
import eu.codearte.jfairy.producer.person.AddressStringProvider; | ||
|
||
/** | ||
* @author omaciaszek | ||
* @since 15.02.15 | ||
*/ | ||
public class PlAddressStringProvider implements AddressStringProvider { | ||
|
||
@Override | ||
public String addressString(Address address) { | ||
return | ||
"ul. " + address.street() + " " + address.streetNumber() + apartmentString( | ||
address) + ", " + address.getPostalCode() | ||
+ " " + address.getCity(); | ||
} | ||
|
||
private String apartmentString(Address address) { | ||
String apartmentString; | ||
if (address.apartmentNumber().equals("")) { | ||
apartmentString = ""; | ||
} else { | ||
apartmentString = " lok. " + address.apartmentNumber(); | ||
} | ||
return apartmentString; | ||
} | ||
} |
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
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
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