Created
April 7, 2017 03:31
-
-
Save nayeemzen/4402f13e21a700da4f3300fc1dd35c3e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// 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