Inline interfaces used in ClientPut
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Mon, 13 Jul 2015 16:21:15 +0000 (18:21 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Mon, 13 Jul 2015 16:21:15 +0000 (18:21 +0200)
src/main/java/net/pterodactylus/fcp/quelaton/ClientPutCommand.java
src/main/java/net/pterodactylus/fcp/quelaton/ClientPutCommandImpl.java
src/main/java/net/pterodactylus/fcp/quelaton/WithLength.java [deleted file]
src/main/java/net/pterodactylus/fcp/quelaton/WithUri.java [deleted file]

index 41c2377..7e900f2 100644 (file)
@@ -16,8 +16,20 @@ public interface ClientPutCommand {
 
        ClientPutCommand onKeyGenerated(Consumer<String> keyGenerated);
        ClientPutCommand named(String targetFilename);
-       WithUri<Executable<Optional<Key>>> redirectTo(String uri);
-       WithUri<Executable<Optional<Key>>> from(File file);
-       WithLength<WithUri<Executable<Optional<Key>>>> from(InputStream inputStream);
+       WithUri redirectTo(String uri);
+       WithUri from(File file);
+       WithLength from(InputStream inputStream);
+
+       interface WithLength {
+
+               WithUri length(long length);
+
+       }
+
+       interface WithUri {
+
+               Executable<Optional<Key>> uri(String uri);
+
+       }
 
 }
index 1b322f3..06d54e0 100644 (file)
@@ -66,24 +66,24 @@ class ClientPutCommandImpl implements ClientPutCommand {
        }
 
        @Override
-       public WithUri<Executable<Optional<Key>>> 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<Executable<Optional<Key>>> 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<WithUri<Executable<Optional<Key>>>> from(InputStream inputStream) {
+       public WithLength from(InputStream inputStream) {
                payload.set(Objects.requireNonNull(inputStream, "inputStream must not be null"));
                return this::length;
        }
 
-       private WithUri<Executable<Optional<Key>>> 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 (file)
index 8d38bf3..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-package net.pterodactylus.fcp.quelaton;
-
-/**
- * An intermediary interface for FCP commands that require a length parameter.
- *
- * @param <R>
- *     The type of the next command part
- * @author <a href="mailto:bombe@freenetproject.org">David ‘Bombe’ Roden</a>
- */
-public interface WithLength<R> {
-
-       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 (file)
index daaae52..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-package net.pterodactylus.fcp.quelaton;
-
-/**
- * The terminal operation of an FCP command, requiring a Freenet URI.
- *
- * @param <R>
- *     The type of the command result
- * @author <a href="mailto:bombe@freenetproject.org">David ‘Bombe’ Roden</a>
- */
-public interface WithUri<R> {
-
-       R uri(String uri);
-
-}