Code example for Address

Methods: getAdminArea, getCountryCode, getCountryName, getFeatureName, getLatitude, getLocality, getLongitude, getPostalCode, getThoroughfare, hasLatitude

0
 
	public static Address setLines(Address a) {
 
		// Line 1 
		StringBuilder sb = new StringBuilder();
		sb.append((a.getFeatureName() != null) ? a.getFeatureName() : "");
		sb.append((a.getThoroughfare() != null) ? " " + a.getThoroughfare() : "");
		a.setAddressLine(0, sb.toString());
 
		// Line 2 
		sb = new StringBuilder();
		sb.append((a.getLocality() != null) ? a.getLocality() : "");
		sb.append((a.getAdminArea() != null) ? " " + a.getAdminArea() : "");
		sb.append((a.getAdminArea() != null && a.getPostalCode() != null)
				? ", " + a.getPostalCode()
						: (a.getPostalCode() != null) ? " " + a.getPostalCode() : "");
		a.setAddressLine(1, sb.toString());
 
		// Line 3 
		sb = new StringBuilder();
		sb.append((a.getCountryCode() != null) ? a.getCountryCode()
				: (a.getCountryName() != null) ? a.getCountryName() : "");
		a.setAddressLine(2, sb.toString());
 
		// Line 4 
		sb = new StringBuilder();
		sb.append(a.hasLatitude() ? "Lat: " + a.getLatitude() : "");
		a.setAddressLine(3, sb.toString());
 
		// Line 5 
		sb = new StringBuilder();
		sb.append(a.hasLongitude() ? "Long: " + a.getLongitude() : "");
		a.setAddressLine(4, sb.toString());
 
		return a;
	} 
 
	public static Address blankAddress() {