WICKET-6269: replaced Wickets serializable functional interfaces by interfaces provided by jdk-serializable-functional
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/20f07bfd Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/20f07bfd Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/20f07bfd Branch: refs/heads/master Commit: 20f07bfdbe3f686d162f8395d258d1d1b22a01cf Parents: d9d142b Author: Emond Papegaaij <[email protected]> Authored: Fri Nov 4 11:00:43 2016 +0100 Committer: Emond Papegaaij <[email protected]> Committed: Fri Nov 4 11:00:43 2016 +0100 ---------------------------------------------------------------------- pom.xml | 6 + wicket-core/pom.xml | 4 + .../wicket/ajax/AbstractAjaxTimerBehavior.java | 4 +- .../wicket/ajax/AjaxClientInfoBehavior.java | 6 +- .../apache/wicket/ajax/AjaxEventBehavior.java | 6 +- .../ajax/AjaxNewWindowNotifyingBehavior.java | 6 +- .../ajax/AjaxSelfUpdatingTimerBehavior.java | 6 +- ...AjaxFormChoiceComponentUpdatingBehavior.java | 20 ++- .../form/AjaxFormComponentUpdatingBehavior.java | 19 +- .../ajax/form/AjaxFormSubmitBehavior.java | 16 +- .../wicket/ajax/form/OnChangeAjaxBehavior.java | 19 +- .../wicket/ajax/markup/html/AjaxLink.java | 12 +- .../ajax/markup/html/form/AjaxButton.java | 9 +- .../ajax/markup/html/form/AjaxCheckBox.java | 6 +- .../ajax/markup/html/form/AjaxSubmitLink.java | 9 +- .../org/apache/wicket/behavior/Behavior.java | 35 ++-- .../java/org/apache/wicket/lambda/Lambdas.java | 176 ++++++++++--------- .../apache/wicket/lambda/WicketBiConsumer.java | 32 ---- .../apache/wicket/lambda/WicketBiFunction.java | 36 ---- .../apache/wicket/lambda/WicketConsumer.java | 32 ---- .../apache/wicket/lambda/WicketFunction.java | 34 ---- .../apache/wicket/lambda/WicketSupplier.java | 32 ---- .../apache/wicket/markup/html/form/Button.java | 15 +- .../apache/wicket/markup/html/link/Link.java | 4 +- .../wicket/markup/html/link/StatelessLink.java | 6 +- .../java/org/apache/wicket/model/IModel.java | 21 ++- .../org/apache/wicket/model/LambdaModel.java | 22 +-- .../wicket/model/LoadableDetachableModel.java | 4 +- .../org/apache/wicket/model/IModelTest.java | 14 +- .../apache/wicket/model/LambdaModelTest.java | 12 +- .../ajax/markup/html/IndicatingAjaxButton.java | 9 +- .../ajax/markup/html/IndicatingAjaxLink.java | 5 +- .../html/repeater/data/table/LambdaColumn.java | 16 +- 33 files changed, 265 insertions(+), 388 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 8c46ecf..3bd117f 100644 --- a/pom.xml +++ b/pom.xml @@ -441,6 +441,12 @@ <type>jar</type> </dependency> <dependency> + <groupId>org.danekja</groupId> + <artifactId>jdk-serializable-functional</artifactId> + <version>1.8.1</version> + <type>jar</type> + </dependency> + <dependency> <groupId>org.jboss.seam.conversation</groupId> <artifactId>seam-conversation-spi</artifactId> <version>3.0.0.Final</version> http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/pom.xml ---------------------------------------------------------------------- diff --git a/wicket-core/pom.xml b/wicket-core/pom.xml index add921d..90aca4a 100644 --- a/wicket-core/pom.xml +++ b/wicket-core/pom.xml @@ -55,6 +55,10 @@ <artifactId>wicket-util</artifactId> </dependency> <dependency> + <groupId>org.danekja</groupId> + <artifactId>jdk-serializable-functional</artifactId> + </dependency> + <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-junit</artifactId> </dependency> http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java index 9fd936b..0c9a276 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java @@ -19,11 +19,11 @@ package org.apache.wicket.ajax; import org.apache.wicket.Component; import org.apache.wicket.Page; import org.apache.wicket.core.request.handler.IPartialPageRequestHandler; -import org.apache.wicket.lambda.WicketConsumer; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.head.OnLoadHeaderItem; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.time.Duration; +import org.danekja.java.util.function.serializable.SerializableConsumer; /** * A behavior that generates an AJAX update callback at a regular interval. @@ -226,7 +226,7 @@ public abstract class AbstractAjaxTimerBehavior extends AbstractDefaultAjaxBehav * the consumer which accepts the {@link AjaxRequestTarget} * @return the {@link AbstractAjaxTimerBehavior} */ - public static AbstractAjaxTimerBehavior onTimer(Duration interval, WicketConsumer<AjaxRequestTarget> onTimer) + public static AbstractAjaxTimerBehavior onTimer(Duration interval, SerializableConsumer<AjaxRequestTarget> onTimer) { Args.notNull(onTimer, "onTimer"); http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxClientInfoBehavior.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxClientInfoBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxClientInfoBehavior.java index 25dde8d..164c551 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxClientInfoBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxClientInfoBehavior.java @@ -19,7 +19,6 @@ package org.apache.wicket.ajax; import org.apache.wicket.Component; import org.apache.wicket.Session; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; -import org.apache.wicket.lambda.WicketBiConsumer; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.head.JavaScriptHeaderItem; import org.apache.wicket.markup.html.pages.BrowserInfoForm; @@ -29,6 +28,7 @@ import org.apache.wicket.request.IRequestParameters; import org.apache.wicket.request.cycle.RequestCycle; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.time.Duration; +import org.danekja.java.util.function.serializable.SerializableBiConsumer; /** * An behavior that collects the information to populate @@ -142,11 +142,11 @@ public class AjaxClientInfoBehavior extends AbstractAjaxTimerBehavior * Creates an {@link AjaxClientInfoBehavior} based on lambda expressions * * @param onClientInfo - * the {@link WicketBiConsumer} which accepts the {@link AjaxRequestTarget} and the + * the {@code SerializableBiConsumer} which accepts the {@link AjaxRequestTarget} and the * {@link WebClientInfo} * @return the {@link AjaxClientInfoBehavior} */ - public static AjaxClientInfoBehavior onClientInfo(WicketBiConsumer<AjaxRequestTarget, WebClientInfo> onClientInfo) + public static AjaxClientInfoBehavior onClientInfo(SerializableBiConsumer<AjaxRequestTarget, WebClientInfo> onClientInfo) { Args.notNull(onClientInfo, "onClientInfo"); http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxEventBehavior.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxEventBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxEventBehavior.java index 0f8aea7..a244a3a 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxEventBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxEventBehavior.java @@ -22,12 +22,12 @@ import java.util.Locale; import org.apache.wicket.Component; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; -import org.apache.wicket.lambda.WicketConsumer; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.head.OnDomReadyHeaderItem; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.lang.Checks; import org.apache.wicket.util.string.Strings; +import org.danekja.java.util.function.serializable.SerializableConsumer; /** * An ajax behavior that is attached to a certain client-side (usually javascript) event, such as @@ -165,10 +165,10 @@ public abstract class AjaxEventBehavior extends AbstractDefaultAjaxBehavior * @param eventName * the event name * @param onEvent - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AjaxEventBehavior} */ - public static AjaxEventBehavior onEvent(String eventName, WicketConsumer<AjaxRequestTarget> onEvent) + public static AjaxEventBehavior onEvent(String eventName, SerializableConsumer<AjaxRequestTarget> onEvent) { Args.notNull(onEvent, "onEvent"); http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java index ae5a73c..0dff154 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java @@ -21,7 +21,6 @@ import java.util.UUID; import org.apache.wicket.Component; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; -import org.apache.wicket.lambda.WicketConsumer; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.head.OnDomReadyHeaderItem; import org.apache.wicket.markup.head.OnLoadHeaderItem; @@ -29,6 +28,7 @@ import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.string.StringValue; import org.apache.wicket.util.string.Strings; +import org.danekja.java.util.function.serializable.SerializableConsumer; /** * An Ajax behavior that notifies when a new browser window/tab is opened with @@ -137,10 +137,10 @@ public abstract class AjaxNewWindowNotifyingBehavior extends AbstractDefaultAjax * @param windowName * the window name * @param onNewWindow - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AjaxNewWindowNotifyingBehavior} */ - public static AjaxNewWindowNotifyingBehavior onNewWindow(String windowName, WicketConsumer<AjaxRequestTarget> onNewWindow) + public static AjaxNewWindowNotifyingBehavior onNewWindow(String windowName, SerializableConsumer<AjaxRequestTarget> onNewWindow) { Args.notNull(onNewWindow, "onNewWindow"); http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxSelfUpdatingTimerBehavior.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxSelfUpdatingTimerBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxSelfUpdatingTimerBehavior.java index 5ebe52a..6d40901 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxSelfUpdatingTimerBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxSelfUpdatingTimerBehavior.java @@ -16,9 +16,9 @@ */ package org.apache.wicket.ajax; -import org.apache.wicket.lambda.WicketConsumer; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.time.Duration; +import org.danekja.java.util.function.serializable.SerializableConsumer; /** * Automatically re-renders the component it is attached to via AJAX at a regular interval. @@ -71,10 +71,10 @@ public class AjaxSelfUpdatingTimerBehavior extends AbstractAjaxTimerBehavior * @param interval * the interval for the self update * @param onTimer - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AbstractAjaxTimerBehavior} */ - public static AjaxSelfUpdatingTimerBehavior onSelfUpdate(Duration interval, WicketConsumer<AjaxRequestTarget> onTimer) + public static AjaxSelfUpdatingTimerBehavior onSelfUpdate(Duration interval, SerializableConsumer<AjaxRequestTarget> onTimer) { Args.notNull(onTimer, "onTimer"); http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java index 1b31f12..7fe6c7c 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java @@ -21,14 +21,14 @@ import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.attributes.AjaxCallListener; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; -import org.apache.wicket.lambda.WicketBiConsumer; -import org.apache.wicket.lambda.WicketConsumer; import org.apache.wicket.markup.html.form.CheckBoxMultipleChoice; import org.apache.wicket.markup.html.form.CheckGroup; import org.apache.wicket.markup.html.form.FormComponent; import org.apache.wicket.markup.html.form.RadioChoice; import org.apache.wicket.markup.html.form.RadioGroup; import org.apache.wicket.util.lang.Args; +import org.danekja.java.util.function.serializable.SerializableBiConsumer; +import org.danekja.java.util.function.serializable.SerializableConsumer; /** * This is a Ajax Component Update Behavior that is meant for choices/groups that are not one @@ -118,10 +118,12 @@ public abstract class AjaxFormChoiceComponentUpdatingBehavior extends * Creates an {@link AjaxFormChoiceComponentUpdatingBehavior} based on lambda expressions * * @param onUpdateChoice - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AjaxFormChoiceComponentUpdatingBehavior} */ - public static AjaxFormChoiceComponentUpdatingBehavior onUpdateChoice(WicketConsumer<AjaxRequestTarget> onUpdateChoice) { + public static AjaxFormChoiceComponentUpdatingBehavior onUpdateChoice( + SerializableConsumer<AjaxRequestTarget> onUpdateChoice) + { Args.notNull(onUpdateChoice, "onUpdateChoice"); return new AjaxFormChoiceComponentUpdatingBehavior() { @@ -139,14 +141,16 @@ public abstract class AjaxFormChoiceComponentUpdatingBehavior extends * Creates an {@link AjaxFormChoiceComponentUpdatingBehavior} based on lambda expressions * * @param onUpdateChoice - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @param onError - * the {@link WicketBiConsumer} which accepts the {@link AjaxRequestTarget} and the + * the {@code SerializableBiConsumer} which accepts the {@link AjaxRequestTarget} and the * {@link RuntimeException} * @return the {@link AjaxFormChoiceComponentUpdatingBehavior} */ - public static AjaxFormChoiceComponentUpdatingBehavior onUpdateChoice(WicketConsumer<AjaxRequestTarget> onUpdateChoice, - WicketBiConsumer<AjaxRequestTarget, RuntimeException> onError) { + public static AjaxFormChoiceComponentUpdatingBehavior onUpdateChoice( + SerializableConsumer<AjaxRequestTarget> onUpdateChoice, + SerializableBiConsumer<AjaxRequestTarget, RuntimeException> onError) + { Args.notNull(onUpdateChoice, "onUpdateChoice"); Args.notNull(onError, "onError"); return new AjaxFormChoiceComponentUpdatingBehavior() http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java index 37930dc..4236692 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java @@ -23,11 +23,11 @@ import org.apache.wicket.ajax.AjaxEventBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes.Method; -import org.apache.wicket.lambda.WicketBiConsumer; -import org.apache.wicket.lambda.WicketConsumer; import org.apache.wicket.markup.html.form.FormComponent; import org.apache.wicket.markup.html.form.validation.IFormValidator; import org.apache.wicket.util.lang.Args; +import org.danekja.java.util.function.serializable.SerializableBiConsumer; +import org.danekja.java.util.function.serializable.SerializableConsumer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -228,10 +228,11 @@ public abstract class AjaxFormComponentUpdatingBehavior extends AjaxEventBehavio * @param eventName * the event name * @param onUpdate - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AjaxFormComponentUpdatingBehavior} */ - public static AjaxFormComponentUpdatingBehavior onUpdate(String eventName, WicketConsumer<AjaxRequestTarget> onUpdate) + public static AjaxFormComponentUpdatingBehavior onUpdate(String eventName, + SerializableConsumer<AjaxRequestTarget> onUpdate) { Args.notNull(onUpdate, "onUpdate"); @@ -253,15 +254,15 @@ public abstract class AjaxFormComponentUpdatingBehavior extends AjaxEventBehavio * @param eventName * the event name * @param onUpdate - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @param onError - * the {@link WicketBiConsumer} which accepts the {@link AjaxRequestTarget} and the - * {@link RuntimeException} + * the {@code SerializableBiConsumer} which accepts the {@link AjaxRequestTarget} and + * the {@link RuntimeException} * @return the {@link AjaxFormComponentUpdatingBehavior} */ public static AjaxFormComponentUpdatingBehavior onUpdate(String eventName, - WicketConsumer<AjaxRequestTarget> onUpdate, - WicketBiConsumer<AjaxRequestTarget, RuntimeException> onError) + SerializableConsumer<AjaxRequestTarget> onUpdate, + SerializableBiConsumer<AjaxRequestTarget, RuntimeException> onError) { Args.notNull(onUpdate, "onUpdate"); Args.notNull(onError, "onError"); http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java index f3cd7eb..8542379 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java @@ -21,12 +21,12 @@ import org.apache.wicket.ajax.AjaxEventBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes.Method; -import org.apache.wicket.lambda.WicketConsumer; import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.IFormSubmitter; import org.apache.wicket.markup.html.form.IFormSubmittingComponent; import org.apache.wicket.util.lang.Args; +import org.danekja.java.util.function.serializable.SerializableConsumer; /** * Ajax event behavior that submits a form via ajax when the event it is attached to, is invoked. @@ -280,10 +280,11 @@ public abstract class AjaxFormSubmitBehavior extends AjaxEventBehavior * @param eventName * the event name * @param onSubmit - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AjaxFormSubmitBehavior} */ - public static AjaxFormSubmitBehavior onSubmit(String eventName, WicketConsumer<AjaxRequestTarget> onSubmit) + public static AjaxFormSubmitBehavior onSubmit(String eventName, + SerializableConsumer<AjaxRequestTarget> onSubmit) { Args.notNull(onSubmit, "onSubmit"); @@ -305,14 +306,15 @@ public abstract class AjaxFormSubmitBehavior extends AjaxEventBehavior * @param eventName * the event name * @param onSubmit - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @param onError - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AjaxFormSubmitBehavior} */ public static AjaxFormSubmitBehavior onSubmit(String eventName, - WicketConsumer<AjaxRequestTarget> onSubmit, - WicketConsumer<AjaxRequestTarget> onError) { + SerializableConsumer<AjaxRequestTarget> onSubmit, + SerializableConsumer<AjaxRequestTarget> onError) + { Args.notNull(onSubmit, "onSubmit"); Args.notNull(onError, "onError"); http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/ajax/form/OnChangeAjaxBehavior.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/form/OnChangeAjaxBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/form/OnChangeAjaxBehavior.java index 54efaea..796dd33 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/form/OnChangeAjaxBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/form/OnChangeAjaxBehavior.java @@ -19,13 +19,12 @@ package org.apache.wicket.ajax.form; import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; -import org.apache.wicket.lambda.Lambdas; -import org.apache.wicket.lambda.WicketBiConsumer; -import org.apache.wicket.lambda.WicketConsumer; import org.apache.wicket.markup.html.form.FormComponent; import org.apache.wicket.markup.html.form.TextArea; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.util.lang.Args; +import org.danekja.java.util.function.serializable.SerializableBiConsumer; +import org.danekja.java.util.function.serializable.SerializableConsumer; /** * A behavior that updates the hosting {@link FormComponent} via Ajax when value of the component is @@ -86,10 +85,10 @@ public abstract class OnChangeAjaxBehavior extends AjaxFormComponentUpdatingBeha * Creates an {@link OnChangeAjaxBehavior} based on lambda expressions * * @param onChange - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link OnChangeAjaxBehavior} */ - public static OnChangeAjaxBehavior onChange(WicketConsumer<AjaxRequestTarget> onChange) + public static OnChangeAjaxBehavior onChange(SerializableConsumer<AjaxRequestTarget> onChange) { Args.notNull(onChange, "onChange"); @@ -109,14 +108,14 @@ public abstract class OnChangeAjaxBehavior extends AjaxFormComponentUpdatingBeha * Creates an {@link OnChangeAjaxBehavior} based on lambda expressions * * @param onChange - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @param onError - * the {@link WicketBiConsumer} which accepts the {@link AjaxRequestTarget} and the - * {@link RuntimeException} + * the {@code SerializableBiConsumer} which accepts the {@link AjaxRequestTarget} and + * the {@link RuntimeException} * @return the {@link OnChangeAjaxBehavior} */ - public static OnChangeAjaxBehavior onChange(WicketConsumer<AjaxRequestTarget> onChange, - WicketBiConsumer<AjaxRequestTarget, RuntimeException> onError) + public static OnChangeAjaxBehavior onChange(SerializableConsumer<AjaxRequestTarget> onChange, + SerializableBiConsumer<AjaxRequestTarget, RuntimeException> onError) { Args.notNull(onChange, "onChange"); Args.notNull(onError, "onError"); http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxLink.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxLink.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxLink.java index 1355872..483c2b4 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxLink.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxLink.java @@ -21,12 +21,12 @@ import org.apache.wicket.IGenericComponent; import org.apache.wicket.ajax.AjaxEventBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; -import org.apache.wicket.lambda.WicketBiConsumer; -import org.apache.wicket.lambda.WicketConsumer; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.html.link.AbstractLink; import org.apache.wicket.model.IModel; import org.apache.wicket.util.lang.Args; +import org.danekja.java.util.function.serializable.SerializableBiConsumer; +import org.danekja.java.util.function.serializable.SerializableConsumer; /** * A component that allows a trigger request to be triggered via html anchor tag @@ -149,10 +149,11 @@ public abstract class AjaxLink<T> extends AbstractLink implements IAjaxLink, IGe * @param id * the id of the ajax link * @param onClick - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AjaxLink} */ - public static <T> AjaxLink<T> onClick(String id, WicketConsumer<AjaxRequestTarget> onClick) + public static <T> AjaxLink<T> onClick(String id, + SerializableConsumer<AjaxRequestTarget> onClick) { Args.notNull(onClick, "onClick"); @@ -177,7 +178,8 @@ public abstract class AjaxLink<T> extends AbstractLink implements IAjaxLink, IGe * the consumer of the clicked link and an {@link AjaxRequestTarget} * @return the {@link AjaxLink} */ - public static <T> AjaxLink<T> onClick(String id, WicketBiConsumer<AjaxLink<T>, AjaxRequestTarget> onClick) + public static <T> AjaxLink<T> onClick(String id, + SerializableBiConsumer<AjaxLink<T>, AjaxRequestTarget> onClick) { Args.notNull(onClick, "onClick"); http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java index cb9f911..03f01a8 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java @@ -20,11 +20,11 @@ import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior; -import org.apache.wicket.lambda.WicketBiConsumer; import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.model.IModel; import org.apache.wicket.util.lang.Args; +import org.danekja.java.util.function.serializable.SerializableBiConsumer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -239,7 +239,8 @@ public abstract class AjaxButton extends Button * the consumer which accepts the button and an {@link AjaxRequestTarget} * @return the {@link AjaxButton} */ - public static AjaxButton onSubmit(String id, WicketBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit) + public static AjaxButton onSubmit(String id, + SerializableBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit) { Args.notNull(onSubmit, "onSubmit"); @@ -267,8 +268,8 @@ public abstract class AjaxButton extends Button * @return the {@link AjaxButton} */ public static AjaxButton onSubmit(String id, - WicketBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit, - WicketBiConsumer<AjaxButton, AjaxRequestTarget> onError) + SerializableBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit, + SerializableBiConsumer<AjaxButton, AjaxRequestTarget> onError) { Args.notNull(onSubmit, "onSubmit"); Args.notNull(onError, "onError"); http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxCheckBox.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxCheckBox.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxCheckBox.java index bd21f74..6fa1221 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxCheckBox.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxCheckBox.java @@ -19,11 +19,10 @@ package org.apache.wicket.ajax.markup.html.form; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; -import org.apache.wicket.lambda.WicketBiConsumer; -import org.apache.wicket.lambda.WicketConsumer; import org.apache.wicket.markup.html.form.CheckBox; import org.apache.wicket.model.IModel; import org.apache.wicket.util.lang.Args; +import org.danekja.java.util.function.serializable.SerializableBiConsumer; /** * A CheckBox which is updated via ajax when the user changes its value @@ -102,7 +101,8 @@ public abstract class AjaxCheckBox extends CheckBox * the consumer of the updated checkbox and an {@link AjaxRequestTarget} * @return the {@link AjaxCheckBox} */ - public static AjaxCheckBox onUpdate(String id, WicketBiConsumer<AjaxCheckBox, AjaxRequestTarget> onUpdate) + public static AjaxCheckBox onUpdate(String id, + SerializableBiConsumer<AjaxCheckBox, AjaxRequestTarget> onUpdate) { Args.notNull(onUpdate, "onUpdate"); http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java index eb0b6e0..38416d1 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java @@ -20,11 +20,11 @@ import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior; -import org.apache.wicket.lambda.WicketBiConsumer; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.html.form.AbstractSubmitLink; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.util.lang.Args; +import org.danekja.java.util.function.serializable.SerializableBiConsumer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -234,7 +234,8 @@ public abstract class AjaxSubmitLink extends AbstractSubmitLink * the consumer which accepts the link and an {@link AjaxRequestTarget} * @return the {@link AjaxSubmitLink} */ - public static AjaxSubmitLink onSubmit(String id, WicketBiConsumer<AjaxSubmitLink, AjaxRequestTarget> onSubmit) + public static AjaxSubmitLink onSubmit(String id, + SerializableBiConsumer<AjaxSubmitLink, AjaxRequestTarget> onSubmit) { Args.notNull(onSubmit, "onSubmit"); @@ -262,8 +263,8 @@ public abstract class AjaxSubmitLink extends AbstractSubmitLink * @return the {@link AjaxSubmitLink} */ public static AjaxSubmitLink onSubmit(String id, - WicketBiConsumer<AjaxSubmitLink, AjaxRequestTarget> onSubmit, - WicketBiConsumer<AjaxSubmitLink, AjaxRequestTarget> onError) + SerializableBiConsumer<AjaxSubmitLink, AjaxRequestTarget> onSubmit, + SerializableBiConsumer<AjaxSubmitLink, AjaxRequestTarget> onError) { Args.notNull(onSubmit, "onSubmit"); Args.notNull(onError, "onError"); http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java b/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java index eae8cad..fa46b86 100644 --- a/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java @@ -21,14 +21,14 @@ import org.apache.wicket.Component; import org.apache.wicket.IComponentAwareEventSink; import org.apache.wicket.IRequestListener; import org.apache.wicket.event.IEvent; -import org.apache.wicket.lambda.WicketConsumer; -import org.apache.wicket.lambda.WicketFunction; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.html.IComponentAwareHeaderContributor; import org.apache.wicket.markup.parser.XmlTag.TagType; import org.apache.wicket.util.io.IClusterable; import org.apache.wicket.util.lang.Args; +import org.danekja.java.util.function.serializable.SerializableConsumer; +import org.danekja.java.util.function.serializable.SerializableFunction; /** * Behaviors are kind of plug-ins for Components. They allow functionality to be added to a @@ -265,19 +265,19 @@ public abstract class Behavior } /** - * Creates a {@link Behavior} that uses the given {@link WicketConsumer consumer} - * to do something with the component's tag. + * Creates a {@link Behavior} that uses the given {@code SerializableConsumer consumer} to do + * something with the component's tag. * * <p> - * Usage:<br/> - * <code>component.add(onTag(tag -> tag.put(key, value)));</code> + * Usage:<br/> + * <code>component.add(onTag(tag -> tag.put(key, value)));</code> * </p> * * @param onTagConsumer - * the {@link WicketConsumer} that accepts the {@link ComponentTag} + * the {@code SerializableConsumer} that accepts the {@link ComponentTag} * @return The created behavior */ - public static Behavior onTag(WicketConsumer<ComponentTag> onTagConsumer) + public static Behavior onTag(SerializableConsumer<ComponentTag> onTagConsumer) { Args.notNull(onTagConsumer, "onTagConsumer"); @@ -292,29 +292,32 @@ public abstract class Behavior } /** - * Creates a {@link Behavior} that uses the given {@link WicketFunction function} - * to do something with a component's attribute. + * Creates a {@link Behavior} that uses the given {@link WicketFunction function} to do + * something with a component's attribute. * * <p> - * Usage:<br/> - * <code>component.add(onAttribute("class", + * Usage:<br/> + * <code>component.add(onAttribute("class", * currentValue -> condition(currentValue) ? "positive" : "negative"));</code> * </p> * * @param name - * the name of the attribute to manipulate + * the name of the attribute to manipulate * @param onAttribute - * the {@link WicketFunction} that accepts the old value of the attribute - * and returns a new value + * the {@code SerializableFunction} that accepts the old value of the attribute and + * returns a new value * @return The created behavior */ - public static Behavior onAttribute(String name, WicketFunction<String, CharSequence> onAttribute) + public static Behavior onAttribute(String name, + SerializableFunction<String, CharSequence> onAttribute) { Args.notEmpty(name, "name"); Args.notNull(onAttribute, "onAttribute"); return new Behavior() { + private static final long serialVersionUID = 1L; + @Override public void onComponentTag(Component component, ComponentTag tag) { http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/lambda/Lambdas.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/lambda/Lambdas.java b/wicket-core/src/main/java/org/apache/wicket/lambda/Lambdas.java index 6341a93..70a06f8 100644 --- a/wicket-core/src/main/java/org/apache/wicket/lambda/Lambdas.java +++ b/wicket-core/src/main/java/org/apache/wicket/lambda/Lambdas.java @@ -35,9 +35,13 @@ import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.html.link.Link; import org.apache.wicket.protocol.http.request.WebClientInfo; import org.apache.wicket.util.time.Duration; +import org.danekja.java.util.function.serializable.SerializableBiConsumer; +import org.danekja.java.util.function.serializable.SerializableConsumer; +import org.danekja.java.util.function.serializable.SerializableFunction; /** - * Convenience class for easy static importing of lambda factory methods in several components and behaviors. + * Convenience class for easy static importing of lambda factory methods in several components and + * behaviors. */ public class Lambdas { @@ -47,13 +51,13 @@ public class Lambdas * @param interval * the interval of the timer * @param onTimer - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AbstractAjaxTimerBehavior} * - * @see AbstractAjaxTimerBehavior#onTimer(Duration, WicketConsumer) + * @see AbstractAjaxTimerBehavior#onTimer(Duration, SerializableConsumer) */ public static AbstractAjaxTimerBehavior onTimer(Duration interval, - WicketConsumer<AjaxRequestTarget> onTimer) + SerializableConsumer<AjaxRequestTarget> onTimer) { return AbstractAjaxTimerBehavior.onTimer(interval, onTimer); } @@ -62,14 +66,14 @@ public class Lambdas * Creates an {@link AjaxClientInfoBehavior} based on lambda expressions * * @param onClientInfo - * the {@link WicketBiConsumer} which accepts the {@link AjaxRequestTarget} and the - * {@link WebClientInfo} + * the {@code SerializableBiConsumer} which accepts the {@link AjaxRequestTarget} and + * the {@link WebClientInfo} * @return the {@link AjaxClientInfoBehavior} * - * @see AjaxClientInfoBehavior#onClientInfo(WicketBiConsumer) + * @see AjaxClientInfoBehavior#onClientInfo(SerializableBiConsumer) */ public static AjaxClientInfoBehavior onClientInfo( - WicketBiConsumer<AjaxRequestTarget, WebClientInfo> onClientInfo) + SerializableBiConsumer<AjaxRequestTarget, WebClientInfo> onClientInfo) { return AjaxClientInfoBehavior.onClientInfo(onClientInfo); } @@ -80,13 +84,13 @@ public class Lambdas * @param eventName * the event name * @param onEvent - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AjaxEventBehavior} * * @see AjaxEventBehavior#onEvent(org.apache.wicket.Component, org.apache.wicket.event.IEvent) */ public static AjaxEventBehavior onEvent(String eventName, - WicketConsumer<AjaxRequestTarget> onEvent) + SerializableConsumer<AjaxRequestTarget> onEvent) { return AjaxEventBehavior.onEvent(eventName, onEvent); } @@ -97,13 +101,13 @@ public class Lambdas * @param windowName * the window name * @param onNewWindow - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AjaxNewWindowNotifyingBehavior} * - * @see AjaxNewWindowNotifyingBehavior#onNewWindow(String, WicketConsumer) + * @see AjaxNewWindowNotifyingBehavior#onNewWindow(String, SerializableConsumer) */ public static AjaxNewWindowNotifyingBehavior onNewWindow(String windowName, - WicketConsumer<AjaxRequestTarget> onNewWindow) + SerializableConsumer<AjaxRequestTarget> onNewWindow) { return AjaxNewWindowNotifyingBehavior.onNewWindow(windowName, onNewWindow); } @@ -114,13 +118,13 @@ public class Lambdas * @param interval * the interval for the self update * @param onTimer - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AjaxSelfUpdatingTimerBehavior} * - * @see AjaxSelfUpdatingTimerBehavior#onSelfUpdate(Duration, WicketConsumer) + * @see AjaxSelfUpdatingTimerBehavior#onSelfUpdate(Duration, SerializableConsumer) */ public static AjaxSelfUpdatingTimerBehavior onSelfUpdate(Duration interval, - WicketConsumer<AjaxRequestTarget> onTimer) + SerializableConsumer<AjaxRequestTarget> onTimer) { return AjaxSelfUpdatingTimerBehavior.onSelfUpdate(interval, onTimer); } @@ -129,13 +133,13 @@ public class Lambdas * Creates an {@link AjaxFormChoiceComponentUpdatingBehavior} based on lambda expressions * * @param onUpdateChoice - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AjaxFormChoiceComponentUpdatingBehavior} * - * @see AjaxFormChoiceComponentUpdatingBehavior#onUpdateChoice(WicketConsumer) + * @see AjaxFormChoiceComponentUpdatingBehavior#onUpdateChoice(SerializableConsumer) */ public static AjaxFormChoiceComponentUpdatingBehavior onUpdateChoice( - WicketConsumer<AjaxRequestTarget> onUpdateChoice) + SerializableConsumer<AjaxRequestTarget> onUpdateChoice) { return AjaxFormChoiceComponentUpdatingBehavior.onUpdateChoice(onUpdateChoice); } @@ -144,17 +148,18 @@ public class Lambdas * Creates an {@link AjaxFormChoiceComponentUpdatingBehavior} based on lambda expressions * * @param onUpdateChoice - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @param onError - * the {@link WicketBiConsumer} which accepts the {@link AjaxRequestTarget} and the - * {@link RuntimeException} + * the {@code SerializableBiConsumer} which accepts the {@link AjaxRequestTarget} and + * the {@link RuntimeException} * @return the {@link AjaxFormChoiceComponentUpdatingBehavior} * - * @see AjaxFormChoiceComponentUpdatingBehavior#onUpdateChoice(WicketConsumer, WicketBiConsumer) + * @see AjaxFormChoiceComponentUpdatingBehavior#onUpdateChoice(SerializableConsumer, + * SerializableBiConsumer) */ public static AjaxFormChoiceComponentUpdatingBehavior onUpdateChoice( - WicketConsumer<AjaxRequestTarget> onUpdateChoice, - WicketBiConsumer<AjaxRequestTarget, RuntimeException> onError) + SerializableConsumer<AjaxRequestTarget> onUpdateChoice, + SerializableBiConsumer<AjaxRequestTarget, RuntimeException> onError) { return AjaxFormChoiceComponentUpdatingBehavior.onUpdateChoice(onUpdateChoice, onError); } @@ -165,13 +170,13 @@ public class Lambdas * @param eventName * the event name * @param onUpdate - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AjaxFormComponentUpdatingBehavior} * - * @see AjaxFormComponentUpdatingBehavior#onUpdate(String, WicketConsumer) + * @see AjaxFormComponentUpdatingBehavior#onUpdate(String, SerializableConsumer) */ public static AjaxFormComponentUpdatingBehavior onUpdate(String eventName, - WicketConsumer<AjaxRequestTarget> onUpdate) + SerializableConsumer<AjaxRequestTarget> onUpdate) { return AjaxFormComponentUpdatingBehavior.onUpdate(eventName, onUpdate); } @@ -182,17 +187,18 @@ public class Lambdas * @param eventName * the event name * @param onUpdate - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @param onError - * the {@link WicketBiConsumer} which accepts the {@link AjaxRequestTarget} and the - * {@link RuntimeException} + * the {@code SerializableBiConsumer} which accepts the {@link AjaxRequestTarget} and + * the {@link RuntimeException} * @return the {@link AjaxFormComponentUpdatingBehavior} * - * @see AjaxFormComponentUpdatingBehavior#onUpdate(String, WicketConsumer, WicketBiConsumer) + * @see AjaxFormComponentUpdatingBehavior#onUpdate(String, SerializableConsumer, + * SerializableBiConsumer) */ public static AjaxFormComponentUpdatingBehavior onUpdate(String eventName, - WicketConsumer<AjaxRequestTarget> onUpdate, - WicketBiConsumer<AjaxRequestTarget, RuntimeException> onError) + SerializableConsumer<AjaxRequestTarget> onUpdate, + SerializableBiConsumer<AjaxRequestTarget, RuntimeException> onError) { return AjaxFormComponentUpdatingBehavior.onUpdate(eventName, onUpdate, onError); } @@ -203,13 +209,13 @@ public class Lambdas * @param eventName * the event name * @param onSubmit - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AjaxFormSubmitBehavior} * - * @see AjaxFormSubmitBehavior#onSubmit(String, WicketConsumer) + * @see AjaxFormSubmitBehavior#onSubmit(String, SerializableConsumer) */ public static AjaxFormSubmitBehavior onSubmit(String eventName, - WicketConsumer<AjaxRequestTarget> onSubmit) + SerializableConsumer<AjaxRequestTarget> onSubmit) { return AjaxFormSubmitBehavior.onSubmit(eventName, onSubmit); } @@ -220,15 +226,16 @@ public class Lambdas * @param eventName * the event name * @param onSubmit - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @param onError - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AjaxFormSubmitBehavior} * - * @see AjaxFormSubmitBehavior#onSubmit(String, WicketConsumer, WicketConsumer) + * @see AjaxFormSubmitBehavior#onSubmit(String, SerializableConsumer, SerializableConsumer) */ public static AjaxFormSubmitBehavior onSubmit(String eventName, - WicketConsumer<AjaxRequestTarget> onSubmit, WicketConsumer<AjaxRequestTarget> onError) + SerializableConsumer<AjaxRequestTarget> onSubmit, + SerializableConsumer<AjaxRequestTarget> onError) { return AjaxFormSubmitBehavior.onSubmit(eventName, onSubmit, onError); } @@ -237,12 +244,12 @@ public class Lambdas * Creates an {@link OnChangeAjaxBehavior} based on lambda expressions * * @param onChange - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link OnChangeAjaxBehavior} * - * @see OnChangeAjaxBehavior#onChange(WicketConsumer) + * @see OnChangeAjaxBehavior#onChange(SerializableConsumer) */ - public static OnChangeAjaxBehavior onChange(WicketConsumer<AjaxRequestTarget> onChange) + public static OnChangeAjaxBehavior onChange(SerializableConsumer<AjaxRequestTarget> onChange) { return OnChangeAjaxBehavior.onChange(onChange); } @@ -251,62 +258,63 @@ public class Lambdas * Creates an {@link OnChangeAjaxBehavior} based on lambda expressions * * @param onChange - * the {@link WicketConsumer} which accepts the {@link AjaxRequestTarget} + * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @param onError - * the {@link WicketBiConsumer} which accepts the {@link AjaxRequestTarget} and the - * {@link RuntimeException} + * the {@code SerializableBiConsumer} which accepts the {@link AjaxRequestTarget} and + * the {@link RuntimeException} * @return the {@link OnChangeAjaxBehavior} * - * @see OnChangeAjaxBehavior#onChange(WicketConsumer, WicketBiConsumer) + * @see OnChangeAjaxBehavior#onChange(SerializableConsumer, SerializableBiConsumer) */ - public static OnChangeAjaxBehavior onChange(WicketConsumer<AjaxRequestTarget> onChange, - WicketBiConsumer<AjaxRequestTarget, RuntimeException> onError) + public static OnChangeAjaxBehavior onChange(SerializableConsumer<AjaxRequestTarget> onChange, + SerializableBiConsumer<AjaxRequestTarget, RuntimeException> onError) { return OnChangeAjaxBehavior.onChange(onChange, onError); } /** - * Creates a {@link Behavior} that uses the given {@link WicketConsumer consumer} - * to do something with the component's tag. + * Creates a {@link Behavior} that uses the given {@code SerializableConsumer consumer} to do + * something with the component's tag. * * <p> - * Usage:<br/> - * <code>component.add(onTag(tag -> tag.put(key, value)));</code> + * Usage:<br/> + * <code>component.add(onTag(tag -> tag.put(key, value)));</code> * </p> * * @param onTagConsumer - * the {@link WicketConsumer} that accepts the {@link ComponentTag} + * the {@code SerializableConsumer} that accepts the {@link ComponentTag} * @return The created behavior * - * @see Behavior#onTag(WicketConsumer) + * @see Behavior#onTag(SerializableConsumer) */ - public static Behavior onTag(WicketConsumer<ComponentTag> onTagConsumer) + public static Behavior onTag(SerializableConsumer<ComponentTag> onTagConsumer) { return Behavior.onTag(onTagConsumer); } /** - * Creates a {@link Behavior} that uses the given {@link WicketFunction function} - * to do something with a component's attribute. + * Creates a {@link Behavior} that uses the given {@code SerializableFunction function} to do + * something with a component's attribute. * * <p> - * Usage:<br/> - * <code>component.add(onAttribute("class", value -> condition ? "positive" : "negative"));</code> + * Usage:<br/> + * <code>component.add(onAttribute("class", value -> condition ? "positive" : "negative"));</code> * </p> * * @param attributeName - * the name of the attribute to manipulate + * the name of the attribute to manipulate * @param onAttribute - * the function that is applied to the attribute value + * the function that is applied to the attribute value * @return The created behavior * - * @see Behavior#onAttribute(String, WicketFunction) + * @see Behavior#onAttribute(String, SerializableFunction) */ - public static Behavior onAttribute(String attributeName, WicketFunction<String, CharSequence> onAttribute) + public static Behavior onAttribute(String attributeName, + SerializableFunction<String, CharSequence> onAttribute) { return Behavior.onAttribute(attributeName, onAttribute); } - + /** * Creates an {@link AjaxLink} based on lambda expressions * @@ -316,9 +324,10 @@ public class Lambdas * the consumer of the clicked link and an {@link AjaxRequestTarget} * @return the {@link AjaxLink} * - * @see AjaxLink#onClick(String, WicketConsumer) + * @see AjaxLink#onClick(String, SerializableConsumer) */ - public static <T> AjaxLink<T> ajaxLink(String id, WicketBiConsumer<AjaxLink<T>, AjaxRequestTarget> onClick) + public static <T> AjaxLink<T> ajaxLink(String id, + SerializableBiConsumer<AjaxLink<T>, AjaxRequestTarget> onClick) { return AjaxLink.onClick(id, onClick); } @@ -332,10 +341,10 @@ public class Lambdas * the consumer of the submitted button and an {@link AjaxRequestTarget} * @return the {@link AjaxButton} * - * @see AjaxButton#onSubmit(String, WicketBiConsumer) + * @see AjaxButton#onSubmit(String, SerializableBiConsumer) */ public static AjaxButton ajaxButton(String id, - WicketBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit) + SerializableBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit) { return AjaxButton.onSubmit(id, onSubmit); } @@ -351,11 +360,11 @@ public class Lambdas * the consumer of the button in error and an {@link AjaxRequestTarget} * @return the {@link AjaxButton} * - * @see AjaxButton#onSubmit(String, WicketBiConsumer, WicketBiConsumer) + * @see AjaxButton#onSubmit(String, SerializableBiConsumer, SerializableBiConsumer) */ public static AjaxButton ajaxButton(String id, - WicketBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit, - WicketBiConsumer<AjaxButton, AjaxRequestTarget> onError) + SerializableBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit, + SerializableBiConsumer<AjaxButton, AjaxRequestTarget> onError) { return AjaxButton.onSubmit(id, onSubmit, onError); } @@ -369,9 +378,10 @@ public class Lambdas * the consumer of the updated checkbox and an {@link AjaxRequestTarget} * @return the {@link AjaxCheckBox} * - * @see AjaxCheckBox#onUpdate(String, WicketConsumer) + * @see AjaxCheckBox#onUpdate(String, SerializableConsumer) */ - public static AjaxCheckBox ajaxCheckBox(String id, WicketBiConsumer<AjaxCheckBox, AjaxRequestTarget> onUpdate) + public static AjaxCheckBox ajaxCheckBox(String id, + SerializableBiConsumer<AjaxCheckBox, AjaxRequestTarget> onUpdate) { return AjaxCheckBox.onUpdate(id, onUpdate); } @@ -385,10 +395,10 @@ public class Lambdas * the consumer of the submitted button and an {@link AjaxRequestTarget} * @return the {@link AjaxSubmitLink} * - * @see AjaxSubmitLink#onSubmit(String, WicketBiConsumer) + * @see AjaxSubmitLink#onSubmit(String, SerializableBiConsumer) */ public static AjaxSubmitLink ajaxSubmitLink(String id, - WicketBiConsumer<AjaxSubmitLink, AjaxRequestTarget> onSubmit) + SerializableBiConsumer<AjaxSubmitLink, AjaxRequestTarget> onSubmit) { return AjaxSubmitLink.onSubmit(id, onSubmit); } @@ -404,13 +414,13 @@ public class Lambdas * the consumer of the link in error and an {@link AjaxRequestTarget} * @return the {@link AjaxSubmitLink} * - * @see AjaxSubmitLink#onSubmit(String, WicketBiConsumer, WicketBiConsumer) + * @see AjaxSubmitLink#onSubmit(String, SerializableBiConsumer, SerializableBiConsumer) */ public static AjaxSubmitLink ajaxSubmitLink(String id, - WicketBiConsumer<AjaxSubmitLink, AjaxRequestTarget> onSubmit, - WicketBiConsumer<AjaxSubmitLink, AjaxRequestTarget> onError) + SerializableBiConsumer<AjaxSubmitLink, AjaxRequestTarget> onSubmit, + SerializableBiConsumer<AjaxSubmitLink, AjaxRequestTarget> onError) { - return AjaxSubmitLink.onSubmit(id, onSubmit, onError); + return AjaxSubmitLink.onSubmit(id, onSubmit, onError); } /** @@ -422,9 +432,9 @@ public class Lambdas * the consumer of the clicked link * @return the {@link Link} * - * @see Link#onClick(String, WicketConsumer) + * @see Link#onClick(String, SerializableConsumer) */ - public static <T> Link<T> link(String id, WicketConsumer<Link<T>> onClick) + public static <T> Link<T> link(String id, SerializableConsumer<Link<T>> onClick) { return Link.onClick(id, onClick); } http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/lambda/WicketBiConsumer.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/lambda/WicketBiConsumer.java b/wicket-core/src/main/java/org/apache/wicket/lambda/WicketBiConsumer.java deleted file mode 100644 index 6f93d6e..0000000 --- a/wicket-core/src/main/java/org/apache/wicket/lambda/WicketBiConsumer.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.lambda; - -import java.io.Serializable; -import java.util.function.BiConsumer; - -/** - * A {@link Serializable} {@link BiConsumer}. - * - * @param <T> - * - the type of the first input to consume - * @param <U> - * - the type of the second input to consume - */ -public interface WicketBiConsumer<T, U> extends BiConsumer<T, U>, Serializable -{ -} http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/lambda/WicketBiFunction.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/lambda/WicketBiFunction.java b/wicket-core/src/main/java/org/apache/wicket/lambda/WicketBiFunction.java deleted file mode 100644 index f5f66a6..0000000 --- a/wicket-core/src/main/java/org/apache/wicket/lambda/WicketBiFunction.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.lambda; - -import java.io.Serializable; -import java.util.function.BiFunction; - -import org.apache.wicket.util.io.IClusterable; - -/** - * A {@link Serializable} {@link BiFunction}. - * - * @param <T> - * - the type of the first input to the function - * @param <U> - * - the type of the second input to the function - * @param <R> - * - the type of the result of the function - */ -public interface WicketBiFunction<T, U, R> extends BiFunction<T, U, R>, IClusterable -{ -} http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/lambda/WicketConsumer.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/lambda/WicketConsumer.java b/wicket-core/src/main/java/org/apache/wicket/lambda/WicketConsumer.java deleted file mode 100644 index 9ffe611..0000000 --- a/wicket-core/src/main/java/org/apache/wicket/lambda/WicketConsumer.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.lambda; - -import java.io.Serializable; -import java.util.function.Consumer; - -import org.apache.wicket.util.io.IClusterable; - -/** - * A {@link Serializable} {@link Consumer}. - * - * @param <T> - * - the type of the input to consume - */ -public interface WicketConsumer<T> extends Consumer<T>, IClusterable -{ -} http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/lambda/WicketFunction.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/lambda/WicketFunction.java b/wicket-core/src/main/java/org/apache/wicket/lambda/WicketFunction.java deleted file mode 100644 index 3016062..0000000 --- a/wicket-core/src/main/java/org/apache/wicket/lambda/WicketFunction.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.lambda; - -import java.io.Serializable; -import java.util.function.Function; - -import org.apache.wicket.util.io.IClusterable; - -/** - * A {@link Serializable} {@link Function}. - * - * @param <T> - * - the type of the input to the function - * @param <R> - * - the type of the result of the function - */ -public interface WicketFunction<T, R> extends Function<T, R>, IClusterable -{ -} http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/lambda/WicketSupplier.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/lambda/WicketSupplier.java b/wicket-core/src/main/java/org/apache/wicket/lambda/WicketSupplier.java deleted file mode 100644 index f25637c..0000000 --- a/wicket-core/src/main/java/org/apache/wicket/lambda/WicketSupplier.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.lambda; - -import java.io.Serializable; -import java.util.function.Supplier; - -import org.apache.wicket.util.io.IClusterable; - -/** - * A {@link Serializable} {@link Supplier}. - * - * @param <T> - * - the type of results supplied by this supplier - */ -public interface WicketSupplier<T> extends Supplier<T>, IClusterable -{ -} http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Button.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Button.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Button.java index 604e964..067f39a 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Button.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Button.java @@ -17,12 +17,12 @@ package org.apache.wicket.markup.html.form; import org.apache.wicket.ajax.markup.html.form.AjaxButton; -import org.apache.wicket.lambda.WicketConsumer; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.MarkupStream; import org.apache.wicket.model.IModel; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.string.Strings; +import org.danekja.java.util.function.serializable.SerializableConsumer; /** * A form button. @@ -261,10 +261,10 @@ public class Button extends FormComponent<String> implements IFormSubmittingComp * @param id * the id of the button * @param onSubmit - * the {@link WicketConsumer} which accepts the {@link Button} + * the {@code SerializableConsumer} which accepts the {@link Button} * @return the {@link Button} */ - public static Button onSubmit(String id, WicketConsumer<Button> onSubmit) + public static Button onSubmit(String id, SerializableConsumer<Button> onSubmit) { Args.notNull(onSubmit, "onSubmit"); @@ -286,14 +286,13 @@ public class Button extends FormComponent<String> implements IFormSubmittingComp * @param id * the id of the button * @param onSubmit - * the {@link WicketConsumer} which accepts the {@link Button} + * the {@code SerializableConsumer} which accepts the {@link Button} * @param onError - * the {@link WicketConsumer} which accepts the {@link Button} + * the {@code SerializableConsumer} which accepts the {@link Button} * @return the {@link AjaxButton} */ - public static Button onSubmit(String id, - WicketConsumer<Button> onSubmit, - WicketConsumer<Button> onError) + public static Button onSubmit(String id, SerializableConsumer<Button> onSubmit, + SerializableConsumer<Button> onError) { Args.notNull(onSubmit, "onSubmit"); Args.notNull(onError, "onError"); http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/markup/html/link/Link.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/link/Link.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/link/Link.java index eaeb77a..8c7f1b1 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/link/Link.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/link/Link.java @@ -21,11 +21,11 @@ import org.apache.wicket.IGenericComponent; import org.apache.wicket.IRequestListener; import org.apache.wicket.Page; import org.apache.wicket.WicketRuntimeException; -import org.apache.wicket.lambda.WicketConsumer; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.model.IModel; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.util.lang.Args; +import org.danekja.java.util.function.serializable.SerializableConsumer; /** * Implementation of a hyperlink component. A link can be used with an anchor (<a href...) @@ -428,7 +428,7 @@ public abstract class Link<T> extends AbstractLink implements IRequestListener, * the consumer of the clicked link * @return the {@link Link} */ - public static <T> Link<T> onClick(String id, WicketConsumer<Link<T>> onClick) + public static <T> Link<T> onClick(String id, SerializableConsumer<Link<T>> onClick) { Args.notNull(onClick, "onClick"); http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/markup/html/link/StatelessLink.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/link/StatelessLink.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/link/StatelessLink.java index ac6d157..05d1fc9 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/link/StatelessLink.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/link/StatelessLink.java @@ -17,8 +17,8 @@ package org.apache.wicket.markup.html.link; -import org.apache.wicket.lambda.WicketConsumer; import org.apache.wicket.util.lang.Args; +import org.danekja.java.util.function.serializable.SerializableConsumer; /** * This link is stateless that means that the url to this link could generate a new page before the @@ -63,10 +63,10 @@ public abstract class StatelessLink<T> extends Link<T> * @param id * the id of the link * @param onClick - * the {@link WicketConsumer} which accepts the {@link Void} + * the {@code SerializableConsumer} which accepts the {@link Void} * @return the {@link Link} */ - public static <T> StatelessLink<T> onClick(String id, WicketConsumer<Link<T>> onClick) + public static <T> StatelessLink<T> onClick(String id, SerializableConsumer<Link<T>> onClick) { Args.notNull(onClick, "onClick"); http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/model/IModel.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/model/IModel.java b/wicket-core/src/main/java/org/apache/wicket/model/IModel.java index 55b5f04..110be3e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/model/IModel.java +++ b/wicket-core/src/main/java/org/apache/wicket/model/IModel.java @@ -17,10 +17,11 @@ package org.apache.wicket.model; -import org.apache.wicket.lambda.WicketBiFunction; -import org.apache.wicket.lambda.WicketFunction; -import org.apache.wicket.lambda.WicketSupplier; import org.apache.wicket.util.lang.Args; +import org.danekja.java.util.function.serializable.SerializableBiFunction; +import org.danekja.java.util.function.serializable.SerializableFunction; +import org.danekja.java.util.function.serializable.SerializablePredicate; +import org.danekja.java.util.function.serializable.SerializableSupplier; /** * A IModel wraps the actual model Object used by a Component. IModel implementations are used as a @@ -96,12 +97,12 @@ public interface IModel<T> extends IDetachable * a predicate to be used for testing the contained object * @return a new IModel */ - default IModel<T> filter(WicketFunction<? super T, Boolean> predicate) + default IModel<T> filter(SerializablePredicate<? super T> predicate) { Args.notNull(predicate, "predicate"); return (IModel<T>)() -> { T object = IModel.this.getObject(); - if (object != null && predicate.apply(object)) + if (object != null && predicate.test(object)) { return object; } @@ -121,7 +122,7 @@ public interface IModel<T> extends IDetachable * a mapper, to be applied to the contained object * @return a new IModel */ - default <R> IModel<R> map(WicketFunction<? super T, R> mapper) + default <R> IModel<R> map(SerializableFunction<? super T, R> mapper) { Args.notNull(mapper, "mapper"); return (IModel<R>)() -> { @@ -152,7 +153,7 @@ public interface IModel<T> extends IDetachable * @return a new IModel */ default <R, U> IModel<R> combineWith(IModel<U> other, - WicketBiFunction<? super T, ? super U, R> combiner) + SerializableBiFunction<? super T, ? super U, R> combiner) { Args.notNull(combiner, "combiner"); Args.notNull(other, "other"); @@ -179,11 +180,13 @@ public interface IModel<T> extends IDetachable * a mapper, to be applied to the contained object * @return a new IModel */ - default <R> IModel<R> flatMap(WicketFunction<? super T, IModel<R>> mapper) + default <R> IModel<R> flatMap(SerializableFunction<? super T, IModel<R>> mapper) { Args.notNull(mapper, "mapper"); return new IModel<R>() { + private static final long serialVersionUID = 1L; + @Override public R getObject() { @@ -267,7 +270,7 @@ public interface IModel<T> extends IDetachable * a supplier to be used as a default * @return a new IModel */ - default IModel<T> orElseGet(WicketSupplier<? extends T> other) + default IModel<T> orElseGet(SerializableSupplier<? extends T> other) { Args.notNull(other, "other"); return (IModel<T>)() -> { http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/model/LambdaModel.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/model/LambdaModel.java b/wicket-core/src/main/java/org/apache/wicket/model/LambdaModel.java index 3266992..8fb9d6a 100644 --- a/wicket-core/src/main/java/org/apache/wicket/model/LambdaModel.java +++ b/wicket-core/src/main/java/org/apache/wicket/model/LambdaModel.java @@ -18,11 +18,11 @@ package org.apache.wicket.model; import java.util.Objects; -import org.apache.wicket.lambda.WicketBiConsumer; -import org.apache.wicket.lambda.WicketConsumer; -import org.apache.wicket.lambda.WicketFunction; -import org.apache.wicket.lambda.WicketSupplier; import org.apache.wicket.util.lang.Args; +import org.danekja.java.util.function.serializable.SerializableBiConsumer; +import org.danekja.java.util.function.serializable.SerializableConsumer; +import org.danekja.java.util.function.serializable.SerializableFunction; +import org.danekja.java.util.function.serializable.SerializableSupplier; /** * <code>LambdaModel</code> is a basic implementation of an <code>IModel</code> @@ -37,8 +37,8 @@ public class LambdaModel<T> implements IModel<T> { private static final long serialVersionUID = 1L; - private final WicketSupplier<T> getter; - private final WicketConsumer<T> setter; + private final SerializableSupplier<T> getter; + private final SerializableConsumer<T> setter; /** * Construct the model, using the given supplier and consumer as @@ -47,7 +47,7 @@ public class LambdaModel<T> implements IModel<T> * @param getter Used for the getObject() method. * @param setter Used for the setObject(T object) method. */ - public LambdaModel(WicketSupplier<T> getter, WicketConsumer<T> setter) + public LambdaModel(SerializableSupplier<T> getter, SerializableConsumer<T> setter) { this.getter = Args.notNull(getter, "getter"); this.setter = Args.notNull(setter, "setter"); @@ -108,7 +108,8 @@ public class LambdaModel<T> implements IModel<T> * * @param <T> model object type */ - public static <T> IModel<T> of(WicketSupplier<T> getter, WicketConsumer<T> setter) { + public static <T> IModel<T> of(SerializableSupplier<T> getter, SerializableConsumer<T> setter) + { return new LambdaModel<>(getter, setter); } @@ -128,7 +129,7 @@ public class LambdaModel<T> implements IModel<T> * * @return model */ - public static <X, T> IModel<T> of(IModel<X> target, WicketFunction<X, T> getter) + public static <X, T> IModel<T> of(IModel<X> target, SerializableFunction<X, T> getter) { Args.notNull(target, "target"); Args.notNull(getter, "getter"); @@ -175,7 +176,8 @@ public class LambdaModel<T> implements IModel<T> * @return model */ - public static <X, T> IModel<T> of(IModel<X> target, WicketFunction<X, T> getter, WicketBiConsumer<X, T> setter) + public static <X, T> IModel<T> of(IModel<X> target, SerializableFunction<X, T> getter, + SerializableBiConsumer<X, T> setter) { Args.notNull(target, "target"); Args.notNull(getter, "getter"); http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/main/java/org/apache/wicket/model/LoadableDetachableModel.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/model/LoadableDetachableModel.java b/wicket-core/src/main/java/org/apache/wicket/model/LoadableDetachableModel.java index c08cebc..d4fcd5e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/model/LoadableDetachableModel.java +++ b/wicket-core/src/main/java/org/apache/wicket/model/LoadableDetachableModel.java @@ -16,7 +16,7 @@ */ package org.apache.wicket.model; -import org.apache.wicket.lambda.WicketSupplier; +import org.danekja.java.util.function.serializable.SerializableSupplier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -202,7 +202,7 @@ public abstract class LoadableDetachableModel<T> implements IModel<T> * @param getter Used for the getObject() method. * @return Model */ - public static <T> IModel<T> of(WicketSupplier<T> getter) + public static <T> IModel<T> of(SerializableSupplier<T> getter) { return new LoadableDetachableModel<T>() { http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/test/java/org/apache/wicket/model/IModelTest.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/model/IModelTest.java b/wicket-core/src/test/java/org/apache/wicket/model/IModelTest.java index 965eac5..d76d117 100644 --- a/wicket-core/src/test/java/org/apache/wicket/model/IModelTest.java +++ b/wicket-core/src/test/java/org/apache/wicket/model/IModelTest.java @@ -20,9 +20,9 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.nullValue; -import org.apache.wicket.lambda.WicketBiFunction; import org.apache.wicket.model.lambda.Address; import org.apache.wicket.model.lambda.Person; +import org.danekja.java.util.function.serializable.SerializableBiFunction; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -96,8 +96,8 @@ public class IModelTest extends Assert public void combineWith() { IModel<String> janeModel = Model.of("Jane"); - WicketBiFunction<Person, String, String> function = - (WicketBiFunction<Person, String, String>) (person1, other) -> + SerializableBiFunction<Person, String, String> function = + (SerializableBiFunction<Person, String, String>) (person1, other) -> person1.getName() + " is in relationship with " + other; IModel<String> relationShipModel = Model.of(person).combineWith(janeModel, function); assertThat(relationShipModel.getObject(), is(equalTo("John is in relationship with Jane"))); @@ -107,8 +107,8 @@ public class IModelTest extends Assert public void combineWithNullObject() { IModel<String> janeModel = Model.of((String)null); - WicketBiFunction<Person, String, String> function = - (WicketBiFunction<Person, String, String>) (person1, other) -> + SerializableBiFunction<Person, String, String> function = + (SerializableBiFunction<Person, String, String>) (person1, other) -> person1.getName() + " is in relationship with " + other; IModel<String> relationShipModel = Model.of(person).combineWith(janeModel, function); assertThat(relationShipModel.getObject(), is(nullValue())); @@ -118,8 +118,8 @@ public class IModelTest extends Assert public void combineWithNullModel() { IModel<String> janeModel = null; - WicketBiFunction<Person, String, String> function = - (WicketBiFunction<Person, String, String>) (person1, other) -> + SerializableBiFunction<Person, String, String> function = + (SerializableBiFunction<Person, String, String>) (person1, other) -> person1.getName() + " is in relationship with " + other; Model.of(person).combineWith(janeModel, function); } http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-core/src/test/java/org/apache/wicket/model/LambdaModelTest.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/model/LambdaModelTest.java b/wicket-core/src/test/java/org/apache/wicket/model/LambdaModelTest.java index 8bb31ff..2cca5a8 100644 --- a/wicket-core/src/test/java/org/apache/wicket/model/LambdaModelTest.java +++ b/wicket-core/src/test/java/org/apache/wicket/model/LambdaModelTest.java @@ -23,9 +23,9 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; import org.apache.wicket.core.util.lang.WicketObjects; -import org.apache.wicket.lambda.WicketConsumer; -import org.apache.wicket.lambda.WicketSupplier; import org.apache.wicket.model.lambda.Person; +import org.danekja.java.util.function.serializable.SerializableConsumer; +import org.danekja.java.util.function.serializable.SerializableSupplier; import org.junit.Test; /** @@ -85,8 +85,8 @@ public class LambdaModelTest public void equality() { Person person = new Person(); - final WicketSupplier<String> getName = person::getName; - final WicketConsumer<String> setName = person::setName; + final SerializableSupplier<String> getName = person::getName; + final SerializableConsumer<String> setName = person::setName; IModel<String> personNameModel1 = new LambdaModel<>(getName, setName); IModel<String> personNameModel2 = new LambdaModel<>(getName, setName); assertEquals(personNameModel1, personNameModel2); @@ -96,8 +96,8 @@ public class LambdaModelTest public void hashcode() { Person person = new Person(); - final WicketSupplier<String> getName = person::getName; - final WicketConsumer<String> setName = person::setName; + final SerializableSupplier<String> getName = person::getName; + final SerializableConsumer<String> setName = person::setName; IModel<String> personNameModel1 = new LambdaModel<>(getName, setName); IModel<String> personNameModel2 = new LambdaModel<>(getName, setName); assertEquals(personNameModel1.hashCode(), personNameModel2.hashCode()); http://git-wip-us.apache.org/repos/asf/wicket/blob/20f07bfd/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java ---------------------------------------------------------------------- diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java index 9f18c8b..989c4a2 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java @@ -21,8 +21,8 @@ import org.apache.wicket.ajax.IAjaxIndicatorAware; import org.apache.wicket.ajax.markup.html.form.AjaxButton; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.model.IModel; -import org.apache.wicket.lambda.WicketBiConsumer; import org.apache.wicket.util.lang.Args; +import org.danekja.java.util.function.serializable.SerializableBiConsumer; /** * A variant of the {@link AjaxButton} that displays a busy indicator while the ajax request is in @@ -96,7 +96,8 @@ public abstract class IndicatingAjaxButton extends AjaxButton implements IAjaxIn } - public static IndicatingAjaxButton onSubmit(String id, WicketBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit) + public static IndicatingAjaxButton onSubmit(String id, + SerializableBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit) { Args.notNull(onSubmit, "onSubmit"); @@ -111,8 +112,8 @@ public abstract class IndicatingAjaxButton extends AjaxButton implements IAjaxIn } public static IndicatingAjaxButton onSubmit(String id, - WicketBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit, - WicketBiConsumer<AjaxButton, AjaxRequestTarget> onError) + SerializableBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit, + SerializableBiConsumer<AjaxButton, AjaxRequestTarget> onError) { Args.notNull(onSubmit, "onSubmit"); Args.notNull(onError, "onError");
