Skip to content

Commit

Permalink
create,. create0 -> fetch, fetch0
Browse files Browse the repository at this point in the history
  • Loading branch information
inzynierr committed Mar 2, 2021
1 parent 9a61ccd commit 89e4de7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/xyz/ethyr/Bootstrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static void main(String... args) {
System.out.println();
scanner.nextLine(); //JAVA IS THE BEST, NO DOUBT

downloaderOptional = DownloaderFactory.create(name, new File(dir), scanner);
downloaderOptional = DownloaderFactory.fetch(name, new File(dir), scanner);
downloaderOptional.ifPresentOrElse(Downloader::downloadImages, () -> {
System.out.printf("No downloader by name %s was found", name);
scanner.reset();
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/xyz/ethyr/downloader/DownloaderFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

public final class DownloaderFactory {

public static Optional<Downloader> create(String name, File dir, Scanner scanner) {
return DownloaderType.getByName(name).map(type -> create0(type, dir, scanner));
public static Optional<Downloader> fetch(String name, File dir, Scanner scanner) {
return DownloaderType.getByName(name).map(type -> fetch0(type, dir, scanner));
}

private static Downloader create0(DownloaderType type, File dir, Scanner scanner) {
private static Downloader fetch0(DownloaderType type, File dir, Scanner scanner) {
try {
return (Downloader) type.getConstructor().invoke(dir, scanner);
} catch (Throwable throwable) {
Expand Down

0 comments on commit 89e4de7

Please sign in to comment.