I am new to design pattern.
My question is what pattern do I use in below case?
interface UserExtractorService {
String getUser(XXXX);
default validate(File file);
}
class AExtractorService {
public String getUser(String url) {
validate(downloadfromWeb(url));
return getFromWeb(url);
}
}
class BExtractorService {
public String getUser(File) {
validate(file);
parsingFromFile(File);
return parsingFromFile(File);
}
}
class Client {
public void GetUsers(String key) {
userExtractorService.getUser(key);
}
public void GetUsers(File file) {
userExtractorService.getUser(file);
}
}
I want to group AExtractor and BExtractor, because it need operate similar behavior.
Aucun commentaire:
Enregistrer un commentaire