From: David ‘Bombe’ Roden Date: Mon, 13 Jul 2015 16:21:15 +0000 (+0200) Subject: Inline interfaces used in ClientPut X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=ebede056b159ea34d294f3fac0e2def790454a48;p=jFCPlib.git Inline interfaces used in ClientPut --- diff --git a/src/main/java/net/pterodactylus/fcp/quelaton/ClientPutCommand.java b/src/main/java/net/pterodactylus/fcp/quelaton/ClientPutCommand.java index 41c2377..7e900f2 100644 --- a/src/main/java/net/pterodactylus/fcp/quelaton/ClientPutCommand.java +++ b/src/main/java/net/pterodactylus/fcp/quelaton/ClientPutCommand.java @@ -16,8 +16,20 @@ public interface ClientPutCommand { ClientPutCommand onKeyGenerated(Consumer keyGenerated); ClientPutCommand named(String targetFilename); - WithUri>> redirectTo(String uri); - WithUri>> from(File file); - WithLength>>> from(InputStream inputStream); + WithUri redirectTo(String uri); + WithUri from(File file); + WithLength from(InputStream inputStream); + + interface WithLength { + + WithUri length(long length); + + } + + interface WithUri { + + Executable> uri(String uri); + + } } diff --git a/src/main/java/net/pterodactylus/fcp/quelaton/ClientPutCommandImpl.java b/src/main/java/net/pterodactylus/fcp/quelaton/ClientPutCommandImpl.java index 1b322f3..06d54e0 100644 --- a/src/main/java/net/pterodactylus/fcp/quelaton/ClientPutCommandImpl.java +++ b/src/main/java/net/pterodactylus/fcp/quelaton/ClientPutCommandImpl.java @@ -66,24 +66,24 @@ class ClientPutCommandImpl implements ClientPutCommand { } @Override - public WithUri>> redirectTo(String uri) { + public WithUri redirectTo(String uri) { this.redirectUri.set(Objects.requireNonNull(uri, "uri must not be null")); return this::key; } @Override - public WithUri>> from(File file) { + public WithUri from(File file) { this.file.set(Objects.requireNonNull(file, "file must not be null")); return this::key; } @Override - public WithLength>>> from(InputStream inputStream) { + public WithLength from(InputStream inputStream) { payload.set(Objects.requireNonNull(inputStream, "inputStream must not be null")); return this::length; } - private WithUri>> length(long length) { + private WithUri length(long length) { this.length.set(length); return this::key; } diff --git a/src/main/java/net/pterodactylus/fcp/quelaton/WithLength.java b/src/main/java/net/pterodactylus/fcp/quelaton/WithLength.java deleted file mode 100644 index 8d38bf3..0000000 --- a/src/main/java/net/pterodactylus/fcp/quelaton/WithLength.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.pterodactylus.fcp.quelaton; - -/** - * An intermediary interface for FCP commands that require a length parameter. - * - * @param - * The type of the next command part - * @author David ‘Bombe’ Roden - */ -public interface WithLength { - - R length(long length); - -} diff --git a/src/main/java/net/pterodactylus/fcp/quelaton/WithUri.java b/src/main/java/net/pterodactylus/fcp/quelaton/WithUri.java deleted file mode 100644 index daaae52..0000000 --- a/src/main/java/net/pterodactylus/fcp/quelaton/WithUri.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.pterodactylus.fcp.quelaton; - -/** - * The terminal operation of an FCP command, requiring a Freenet URI. - * - * @param - * The type of the command result - * @author David ‘Bombe’ Roden - */ -public interface WithUri { - - R uri(String uri); - -}