diff --git a/wicketstuff-rest-lambda/src/main/java/org/wicketstuff/rest/lambda/mounter/LambdaRestMounter.java b/wicketstuff-rest-lambda/src/main/java/org/wicketstuff/rest/lambda/mounter/LambdaRestMounter.java index 8c4e29ac41..cdc005b8b3 100644 --- a/wicketstuff-rest-lambda/src/main/java/org/wicketstuff/rest/lambda/mounter/LambdaRestMounter.java +++ b/wicketstuff-rest-lambda/src/main/java/org/wicketstuff/rest/lambda/mounter/LambdaRestMounter.java @@ -16,12 +16,13 @@ */ package org.wicketstuff.rest.lambda.mounter; +import java.util.function.Consumer; +import java.util.function.Function; + import org.apache.wicket.core.request.mapper.ResourceMapper; import org.apache.wicket.protocol.http.WebApplication; import org.apache.wicket.request.resource.IResource; import org.apache.wicket.request.resource.ResourceReference; -import org.danekja.java.util.function.serializable.SerializableConsumer; -import org.danekja.java.util.function.serializable.SerializableFunction; import org.wicketstuff.rest.lambda.request.mapper.RestResourceMapper; import org.wicketstuff.rest.lambda.resource.SimpleLambdaResource; import org.wicketstuff.rest.lambda.resource.TextOutputLambdaResource; @@ -62,8 +63,8 @@ public LambdaRestMounter(WebApplication application) * @param respondFunction the respond function * @param outputFunction the output function */ - public void post(final String path, final SerializableFunction respondFunction, - final SerializableFunction outputFunction) + public void post(final String path, final Function respondFunction, + final Function outputFunction) { mountRestResource(HttpMethod.POST, path, respondFunction, outputFunction); } @@ -75,7 +76,7 @@ public void post(final String path, final SerializableFunction respondConsumer) + public void post(final String path, final Consumer respondConsumer) { mountRestResource(HttpMethod.POST, path, respondConsumer); } @@ -88,8 +89,8 @@ public void post(final String path, final SerializableConsumer respondFunction, - final SerializableFunction outputFunction) + public void get(final String path, final Function respondFunction, + final Function outputFunction) { mountRestResource(HttpMethod.GET, path, respondFunction, outputFunction); } @@ -101,7 +102,7 @@ public void get(final String path, final SerializableFunction respondConsumer) + public void get(final String path, final Consumer respondConsumer) { mountRestResource(HttpMethod.GET, path, respondConsumer); } @@ -113,7 +114,7 @@ public void get(final String path, final SerializableConsumer * @param path the mounting path * @param respondConsumer the respond consumer */ - public void put(final String path, final SerializableConsumer respondConsumer) + public void put(final String path, final Consumer respondConsumer) { mountRestResource(HttpMethod.PUT, path, respondConsumer); } @@ -126,8 +127,8 @@ public void put(final String path, final SerializableConsumer * @param respondFunction the respond function * @param outputFunction the output function */ - public void put(final String path, final SerializableFunction respondFunction, - final SerializableFunction outputFunction) + public void put(final String path, final Function respondFunction, + final Function outputFunction) { mountRestResource(HttpMethod.PUT, path, respondFunction, outputFunction); } @@ -139,7 +140,7 @@ public void put(final String path, final SerializableFunction respondConsumer) + public void delete(final String path, final Consumer respondConsumer) { mountRestResource(HttpMethod.DELETE, path, respondConsumer); } @@ -152,8 +153,8 @@ public void delete(final String path, final SerializableConsumer respondFunction, - final SerializableFunction outputFunction) + public void delete(final String path, final Function respondFunction, + final Function outputFunction) { mountRestResource(HttpMethod.DELETE, path, respondFunction, outputFunction); } @@ -165,7 +166,7 @@ public void delete(final String path, final SerializableFunction respondConsumer) + public void options(final String path, final Consumer respondConsumer) { mountRestResource(HttpMethod.OPTIONS, path, respondConsumer); } @@ -178,8 +179,8 @@ public void options(final String path, final SerializableConsumer respondFunction, - final SerializableFunction outputFunction) + public void options(final String path, final Function respondFunction, + final Function outputFunction) { mountRestResource(HttpMethod.OPTIONS, path, respondFunction, outputFunction); } @@ -191,7 +192,7 @@ public void options(final String path, final SerializableFunction respondConsumer) + public void patch(final String path, final Consumer respondConsumer) { mountRestResource(HttpMethod.PATCH, path, respondConsumer); } @@ -204,8 +205,8 @@ public void patch(final String path, final SerializableConsumer respondFunction, - final SerializableFunction outputFunction) + public void patch(final String path, final Function respondFunction, + final Function outputFunction) { mountRestResource(HttpMethod.PATCH, path, respondFunction, outputFunction); } @@ -217,7 +218,7 @@ public void patch(final String path, final SerializableFunction respondConsumer) + public void head(final String path, final Consumer respondConsumer) { mountRestResource(HttpMethod.HEAD, path, respondConsumer); } @@ -230,8 +231,8 @@ public void head(final String path, final SerializableConsumer respondFunction, - final SerializableFunction outputFunction) + public void head(final String path, final Function respondFunction, + final Function outputFunction) { mountRestResource(HttpMethod.HEAD, path, respondFunction, outputFunction); } @@ -243,7 +244,7 @@ public void head(final String path, final SerializableFunction respondConsumer) + public void trace(final String path, final Consumer respondConsumer) { mountRestResource(HttpMethod.TRACE, path, respondConsumer); } @@ -256,8 +257,8 @@ public void trace(final String path, final SerializableConsumer respondFunction, - final SerializableFunction outputFunction) + public void trace(final String path, final Function respondFunction, + final Function outputFunction) { mountRestResource(HttpMethod.TRACE, path, respondFunction, outputFunction); } @@ -272,8 +273,8 @@ public void trace(final String path, final SerializableFunction respondFunction, - final SerializableFunction outputFunction) + final Function respondFunction, + final Function outputFunction) { TextOutputLambdaResource resource = new TextOutputLambdaResource(respondFunction, outputFunction); return mountRestResource(httpMethod, path, resource); @@ -288,7 +289,7 @@ public ResourceMapper mountRestResource(final HttpMethod httpMethod, final Strin * @return the resource mapper */ public ResourceMapper mountRestResource(final HttpMethod httpMethod, final String path, - final SerializableConsumer respondConsumer) + final Consumer respondConsumer) { SimpleLambdaResource resource = new SimpleLambdaResource(respondConsumer); return mountRestResource(httpMethod, path, resource); diff --git a/wicketstuff-rest-lambda/src/main/java/org/wicketstuff/rest/lambda/resource/SimpleLambdaResource.java b/wicketstuff-rest-lambda/src/main/java/org/wicketstuff/rest/lambda/resource/SimpleLambdaResource.java index 848232e1bb..b808f98e09 100644 --- a/wicketstuff-rest-lambda/src/main/java/org/wicketstuff/rest/lambda/resource/SimpleLambdaResource.java +++ b/wicketstuff-rest-lambda/src/main/java/org/wicketstuff/rest/lambda/resource/SimpleLambdaResource.java @@ -16,8 +16,9 @@ */ package org.wicketstuff.rest.lambda.resource; +import java.util.function.Consumer; + import org.apache.wicket.request.resource.IResource; -import org.danekja.java.util.function.serializable.SerializableConsumer; import org.wicketstuff.rest.utils.wicket.AttributesWrapper; /** @@ -34,7 +35,7 @@ public class SimpleLambdaResource implements IResource { */ private static final long serialVersionUID = -4514142899864801685L; - protected final SerializableConsumer respondConsumer; + protected final Consumer respondConsumer; /** * Build a new resource providing the {@link java.util.function.Consumer} @@ -43,7 +44,7 @@ public class SimpleLambdaResource implements IResource { * @param respondConsumer * the cosnumer. */ - public SimpleLambdaResource(SerializableConsumer respondConsumer) + public SimpleLambdaResource(Consumer respondConsumer) { this.respondConsumer = respondConsumer; } diff --git a/wicketstuff-rest-lambda/src/main/java/org/wicketstuff/rest/lambda/resource/TextOutputLambdaResource.java b/wicketstuff-rest-lambda/src/main/java/org/wicketstuff/rest/lambda/resource/TextOutputLambdaResource.java index 4910acec44..9c7d0f62dc 100644 --- a/wicketstuff-rest-lambda/src/main/java/org/wicketstuff/rest/lambda/resource/TextOutputLambdaResource.java +++ b/wicketstuff-rest-lambda/src/main/java/org/wicketstuff/rest/lambda/resource/TextOutputLambdaResource.java @@ -18,10 +18,10 @@ import java.util.Optional; import java.util.function.Consumer; +import java.util.function.Function; import org.apache.wicket.request.http.WebResponse; import org.apache.wicket.request.resource.IResource; -import org.danekja.java.util.function.serializable.SerializableFunction; import org.wicketstuff.rest.utils.wicket.AttributesWrapper; /** @@ -41,9 +41,9 @@ public class TextOutputLambdaResource implements IResource */ private static final long serialVersionUID = 2761454069675861246L; - final private SerializableFunction respondFunction; + final private Function respondFunction; - final private SerializableFunction outputTextFunction; + final private Function outputTextFunction; /** * Build a new resource using the two provided functions. @@ -53,8 +53,8 @@ public class TextOutputLambdaResource implements IResource * @param outputTextFunction * the function used to convert the respond result to text. */ - public TextOutputLambdaResource(SerializableFunction respondFunction, - SerializableFunction outputTextFunction) + public TextOutputLambdaResource(Function respondFunction, + Function outputTextFunction) { this.respondFunction = respondFunction; this.outputTextFunction = outputTextFunction;