Skip to content

Instantly share code, notes, and snippets.

@pserwylo
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pserwylo/f4b8d3a12a96ef375199 to your computer and use it in GitHub Desktop.
Save pserwylo/f4b8d3a12a96ef375199 to your computer and use it in GitHub Desktop.
Downloaders without the base class having to implement UIL interface in the base class.
abstract class Downloader {}
abstract class CacheableDownloader extends Downloader {
abstract boolean isCached();
abstract void setCacheIdentifier(String id)
}
class HTTPDownloader extends CacheableDownloader {
void setCacheIdentifier(String id) {
this.etag = id;
}
boolean isCached() {
return serverEtag.equals(this.etag);
}
}
class BluetoothDownloader extends Downloader {}
class IndexDownloader {
private Downloader downloader;
}
class ApkDownloader {
private Downloader downloader;
}
class UILDownloader implements uil.ImageDownloader {
private Downloader downloader;
public InputStream inputStream() {
return downloader.getInputStream()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment