Skip to content

Instantly share code, notes, and snippets.

@nayeemzen
Created April 7, 2017 03:31
Show Gist options
  • Save nayeemzen/4402f13e21a700da4f3300fc1dd35c3e to your computer and use it in GitHub Desktop.
Save nayeemzen/4402f13e21a700da4f3300fc1dd35c3e to your computer and use it in GitHub Desktop.
// Now we can have multiple implementations of MapClient interface.
class GoogleMapsClientImpl implements MapsClient {
  private GoogleMapsClient googleMapsClient;
public GoogleMapsClientImpl(GoogleMapsClient client) {
googleMapsClient = client;
}
@Override
public boolean isVerified(String address) {
return googleMapsClient.verifyAddress(address).result == Result.SUCCESS;
}
}
class BingMapsClientImpl implements MapsClient {
private BingMapsClient bingMapsClient;
public BingMapsClientImpl(BingMapsClient client) {
bingMapsClient = client;
}
@Override
public boolean isVerified(String address) {
return bingMapsClient.getAddress(address).result.isValid;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment