You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2020/05/04 12:38:01 UTC
[wicket] branch master updated: WICKET-6777 Use string
concatenation instead of formatting and replace switch with enum parameter
(#426)
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git
The following commit(s) were added to refs/heads/master by this push:
new cd964f1 WICKET-6777 Use string concatenation instead of formatting and replace switch with enum parameter (#426)
cd964f1 is described below
commit cd964f1e0008d0edeaeed629152d4d1a1f2586e3
Author: Thomas <th...@gmail.com>
AuthorDate: Mon May 4 14:37:52 2020 +0200
WICKET-6777 Use string concatenation instead of formatting and replace switch with enum parameter (#426)
---
.../java/org/apache/wicket/ajax/AjaxChannel.java | 36 ++++++++--------------
1 file changed, 13 insertions(+), 23 deletions(-)
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxChannel.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxChannel.java
index 45b050c..e2adcf1 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxChannel.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxChannel.java
@@ -43,18 +43,27 @@ public class AjaxChannel implements IClusterable
/**
* Ajax requests are kept in a Queue at the client side and processed one at a time
+ *
+ * 's' comes from 'stack', but it really acts as a queue.
*/
- QUEUE,
+ QUEUE("s"),
/**
* dropping - only the last Ajax request is processed, the others are discarded
*/
- DROP,
+ DROP("d"),
/**
* the ajax call will discarded if there is an active/running request on the same channel
*/
- ACTIVE
+ ACTIVE("a");
+
+ private final String shortType;
+
+ Type(String shortType)
+ {
+ this.shortType = shortType;
+ }
}
/**
@@ -132,26 +141,7 @@ public class AjaxChannel implements IClusterable
@Override
public String toString()
{
- return String.format("%s|%s", name, getShortType(type));
- }
-
- private String getShortType(Type t)
- {
- String shortType;
- switch (t)
- {
- case DROP:
- shortType = "d";
- break;
- case ACTIVE:
- shortType = "a";
- break;
- case QUEUE:
- default:
- // 's' comes from 'stack', but it really acts as a queue.
- shortType = "s";
- }
- return shortType;
+ return name + "|" + type.shortType;
}
@Override