Code example for Address

Methods: getAddressLine, getAdminArea, getCountryCode, getCountryName, getFeatureName, getLatitude, getLocality, getLongitude, getMaxAddressLineIndex, getPostalCode

0
		return (PoolAddress.isComplete(a) && a.hasLatitude() && a.hasLongitude());
	} 
 
	public static String toString(Address a) {
		return String.format("%1$s%2$s%3$s",
				(a.getMaxAddressLineIndex() >= 0) ? a.getAddressLine(0) : "",
				(a.getMaxAddressLineIndex() >= 1) ? "\n"+a.getAddressLine(1) : "",
				(a.getMaxAddressLineIndex() >= 2) ? "\n"+a.getAddressLine(2) : "");
	} 
 
	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() {