Move to Java 8, with CompletableFutures, etc.
diff --git a/src/main/java/com/intel/jndn/utils/Client.java b/src/main/java/com/intel/jndn/utils/Client.java
index 6b09f9f..711d24c 100644
--- a/src/main/java/com/intel/jndn/utils/Client.java
+++ b/src/main/java/com/intel/jndn/utils/Client.java
@@ -14,10 +14,11 @@
package com.intel.jndn.utils;
import java.io.IOException;
-import java.util.concurrent.Future;
+import java.util.concurrent.CompletableFuture;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
+import net.named_data.jndn.Name;
/**
* Base functionality provided by all NDN clients in this package.
@@ -28,23 +29,53 @@
/**
* Asynchronously request the Data for an Interest. This will send the
- * Interest and return immediately; use futureData.get() to block until the
- * Data returns (see Future) or manage the event processing independently.
+ * Interest and return immediately; with this method, the user is responsible
+ * for calling {@link Face#processEvents()} in order for the
+ * {@link CompletableFuture} to complete.
*
- * @param face
- * @param interest
- * @return
+ * @param face the {@link Face} on which to make the request; call
+ * {@link Face#processEvents()} separately to complete the request
+ * @param interest the {@link Interest} to send over the network
+ * @return a future {@link Data} packet
*/
- public Future<Data> getAsync(Face face, Interest interest);
+ public CompletableFuture<Data> getAsync(Face face, Interest interest);
/**
- * Synchronously retrieve the Data for an Interest; this will block until
- * complete (i.e. either data is received or the interest times out).
+ * Convenience method for calling
+ * {@link #getAsync(net.named_data.jndn.Face, net.named_data.jndn.Interest)}
+ * with a default {@link Interest} packet.
*
- * @param face
- * @param interest
- * @return
- * @throws java.io.IOException
+ * @param face the {@link Face} on which to make the request; call
+ * {@link Face#processEvents()} separately to complete the request
+ * @param name the {@link Name} to wrap inside a default {@link Interest}
+ * @return a future {@link Data} packet
+ */
+ public CompletableFuture<Data> getAsync(Face face, Name name);
+
+ /**
+ * Synchronously retrieve the {@link Data} for an {@link Interest}; this will
+ * block until complete (i.e. either the data is received or the interest
+ * times out).
+ *
+ * @param face the {@link Face} on which to make the request; this method will
+ * call {@link Face#processEvents()} at a configurable interval until complete
+ * or timeout
+ * @param interest the {@link Interest} to send over the network
+ * @return a {@link Data} packet
+ * @throws java.io.IOException if the request fails
*/
public Data getSync(Face face, Interest interest) throws IOException;
+
+ /**
+ * Convenience method for calling
+ * {@link #getSync(net.named_data.jndn.Face, net.named_data.jndn.Interest)}
+ * with a default {@link Interest} packet.
+ *
+ * @param face the {@link Face} on which to make the request; call
+ * {@link Face#processEvents()} separately to complete the request
+ * @param name the {@link Name} to wrap inside a default {@link Interest}
+ * @return a {@link Data} packet
+ * @throws java.io.IOException if the request fails
+ */
+ public Data getSync(Face face, Name name) throws IOException;
}