You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by so...@apache.org on 2020/05/08 02:10:31 UTC
[wicket] 02/02: [WICKET-6783] MicroMap is deprecated, typo is fixed
This is an automated email from the ASF dual-hosted git repository.
solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git
commit 8dcbb51d5e8a9c4b290975c6532cfdae34282f94
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Thu May 7 06:44:06 2020 +0700
[WICKET-6783] MicroMap is deprecated, typo is fixed
---
.../html/navigation/paging/PagingNavigation.java | 62 +++++++++++-----------
.../apache/wicket/util/collections/MicroMap.java | 7 ++-
.../apache/wicket/util/collections/MiniMap.java | 20 +++----
3 files changed, 46 insertions(+), 43 deletions(-)
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigation.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigation.java
index cce7c63..dd05e8b 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigation.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigation.java
@@ -33,27 +33,27 @@ import org.apache.wicket.util.collections.MicroMap;
* <p>
* For each row (one page of the list of pages) a {@link PagingNavigationLink}will be added that
* contains a {@link Label} with the page number of that link (1..n).
- *
+ *
* <pre>
- *
+ *
* <td wicket:id="navigation">
* <a wicket:id="pageLink" href="SearchCDPage.html">
* <span wicket:id="pageNumber">1</span>
* </a>
* </td>
- *
+ *
* </pre>
- *
+ *
* thus renders like:
- *
+ *
* <pre>
* 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
* </pre>
- *
+ *
* </p>
* <p>
* Override method populateItem to customize the rendering of the navigation. For instance:
- *
+ *
* <pre>
* protected void populateItem(LoopItem loopItem)
* {
@@ -72,9 +72,9 @@ import org.apache.wicket.util.collections.MicroMap;
* loopItem.add(link);
* }
* </pre>
- *
+ *
* With:
- *
+ *
* <pre>
* <span wicket:id="navigation">
* <span wicket:id="separator"></span>
@@ -83,13 +83,13 @@ import org.apache.wicket.util.collections.MicroMap;
* </a>
* </span>
* </pre>
- *
+ *
* renders like:
- *
+ *
* <pre>
* page1 | page2 | page3 | page4 | page5 | page6 | page7 | page8 | page9
* </pre>
- *
+ *
* </p>
* Assuming a PageableListView with 1000 entries and not more than 10 lines shall be printed per
* page, the navigation bar would have 100 entries. Because this is not feasible PagingNavigation's
@@ -103,10 +103,10 @@ import org.apache.wicket.util.collections.MicroMap;
* Use setMargin() and setViewSize() to adjust the navigation's bar view size and margin.
* <p>
* Please
- *
+ *
* @see PagingNavigator for a ready made component which already includes links to the first,
* previous, next and last page.
- *
+ *
* @author Jonathan Locke
* @author Eelco Hillenius
* @author Juergen Donnerstag
@@ -141,7 +141,7 @@ public class PagingNavigation extends Loop
/**
* Constructor.
- *
+ *
* @param id
* See Component
* @param pageable
@@ -154,7 +154,7 @@ public class PagingNavigation extends Loop
/**
* Constructor.
- *
+ *
* @param id
* See Component
* @param pageable
@@ -173,7 +173,7 @@ public class PagingNavigation extends Loop
/**
* Gets the margin, default value is half the view size, unless explicitly set.
- *
+ *
* @return the margin
*/
public long getMargin()
@@ -187,7 +187,7 @@ public class PagingNavigation extends Loop
/**
* Gets the seperator.
- *
+ *
* @return the seperator
*/
public String getSeparator()
@@ -197,7 +197,7 @@ public class PagingNavigation extends Loop
/**
* Gets the view size (is fixed by user).
- *
+ *
* @return view size
*/
public int getViewSize()
@@ -207,7 +207,7 @@ public class PagingNavigation extends Loop
/**
* view size of the navigation bar.
- *
+ *
* @param size
*/
public void setViewSize(final int size)
@@ -217,7 +217,7 @@ public class PagingNavigation extends Loop
/**
* Sets the margin.
- *
+ *
* @param margin
* the margin
*/
@@ -228,7 +228,7 @@ public class PagingNavigation extends Loop
/**
* Sets the seperator. Null meaning, no separator at all.
- *
+ *
* @param separator
* the seperator
*/
@@ -253,7 +253,7 @@ public class PagingNavigation extends Loop
/**
* Allow subclasses replacing populateItem to calculate the current page number
- *
+ *
* @return start index
*/
protected final long getStartIndex()
@@ -265,7 +265,7 @@ public class PagingNavigation extends Loop
* Populate the current cell with a page link (PagingNavigationLink) enclosing the page number
* the link is pointing to. Subclasses may provide there own implementation adding more
* sophisticated page links.
- *
+ *
* @see org.apache.wicket.markup.html.list.Loop#populateItem(org.apache.wicket.markup.html.list.LoopItem)
*/
@Override
@@ -294,7 +294,7 @@ public class PagingNavigation extends Loop
/**
* Factory method for creating page number links.
- *
+ *
* @param id
* the component id.
* @param pageable
@@ -310,8 +310,8 @@ public class PagingNavigation extends Loop
/**
* Renders the page link. Add the separator if not the last page link
- *
- * @see Loop#renderItem(org.apache.wicket.markup.html.list.LoopItem)
+ *
+ * @see Loop#renderItem(org.apache.wicket.markup.html.list.LoopItem)
*/
@Override
protected void renderItem(final LoopItem loopItem)
@@ -385,7 +385,7 @@ public class PagingNavigation extends Loop
/**
* Set the number of iterations.
- *
+ *
* @param i
* the number of iterations
*/
@@ -396,7 +396,7 @@ public class PagingNavigation extends Loop
/**
* Appends title attribute to navigation links
- *
+ *
* @author igor.vaynberg
*/
private final class TitleAppender extends Behavior
@@ -409,7 +409,7 @@ public class PagingNavigation extends Loop
/**
* Constructor
- *
+ *
* @param page
* page number to use as the ${page} var
*/
@@ -423,7 +423,7 @@ public class PagingNavigation extends Loop
public void onComponentTag(Component component, ComponentTag tag)
{
String pageIndex = String.valueOf(page + 1).intern();
- Map<String, String> vars = new MicroMap<String, String>("page", pageIndex);
+ Map<String, String> vars = Map.of("page", pageIndex);
tag.put("title", PagingNavigation.this.getString(RES, Model.ofMap(vars)));
}
}
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/collections/MicroMap.java b/wicket-util/src/main/java/org/apache/wicket/util/collections/MicroMap.java
index e468f3b..f18c664 100644
--- a/wicket-util/src/main/java/org/apache/wicket/util/collections/MicroMap.java
+++ b/wicket-util/src/main/java/org/apache/wicket/util/collections/MicroMap.java
@@ -29,13 +29,16 @@ import java.util.Set;
* An implementation of the java.util.Map interface which can only hold a single object. This is
* particularly useful to control memory usage in Wicket because many containers hold only a single
* component.
- *
+ *
* @author Jonathan Locke
* @param <K>
* Key type
* @param <V>
* Value type
+ *
+ * @deprecated Please use {@link Map#of(Object, Object)} instead
*/
+@Deprecated(forRemoval = true, since = "9.0.0")
public final class MicroMap<K, V> implements Map<K, V>, Serializable
{
private static final long serialVersionUID = 1L;
@@ -58,7 +61,7 @@ public final class MicroMap<K, V> implements Map<K, V>, Serializable
/**
* Constructs map with a single key and value pair.
- *
+ *
* @param key
* The key
* @param value
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/collections/MiniMap.java b/wicket-util/src/main/java/org/apache/wicket/util/collections/MiniMap.java
index c931466..21d8102 100644
--- a/wicket-util/src/main/java/org/apache/wicket/util/collections/MiniMap.java
+++ b/wicket-util/src/main/java/org/apache/wicket/util/collections/MiniMap.java
@@ -28,7 +28,7 @@ import java.util.Set;
/**
* A fixed size map implementation. Holds an array of keys and array of values which correspond by
* index. Null key entries are available for use. This means that null is not a valid key.
- *
+ *
* @author Jonathan Locke
* @param <K>
* Key type
@@ -53,7 +53,7 @@ public class MiniMap<K, V> implements Map<K, V>, Serializable
/**
* Constructor
- *
+ *
* @param maxEntries
* The maximum number of entries this map can hold
*/
@@ -66,7 +66,7 @@ public class MiniMap<K, V> implements Map<K, V>, Serializable
/**
* Constructor
- *
+ *
* @param map
* The map
* @param maxEntries
@@ -79,7 +79,7 @@ public class MiniMap<K, V> implements Map<K, V>, Serializable
}
/**
- * @return True if this MicroMap is full
+ * @return True if this MiniMap is full
*/
public boolean isFull()
{
@@ -396,7 +396,7 @@ public class MiniMap<K, V> implements Map<K, V>, Serializable
/**
* Computes the next index in the key or value array (both are the same length)
- *
+ *
* @param index
* The index
* @return The next index, taking into account wraparound
@@ -408,7 +408,7 @@ public class MiniMap<K, V> implements Map<K, V>, Serializable
/**
* Finds the index of the next non-null key. If the map is empty, -1 will be returned.
- *
+ *
* @param start
* Index to start at
* @return Index of next non-null key
@@ -434,7 +434,7 @@ public class MiniMap<K, V> implements Map<K, V>, Serializable
/**
* Finds the index of the next null key. If no null key can be found, the map is full and -1
* will be returned.
- *
+ *
* @param start
* Index to start at
* @return Index of next null key
@@ -461,7 +461,7 @@ public class MiniMap<K, V> implements Map<K, V>, Serializable
* Finds a key by starting at lastSearchIndex and searching from there. If the key is found,
* lastSearchIndex is advanced so the next key search can find the next key in the array, which
* is the most likely to be retrieved.
- *
+ *
* @param key
* Key to find in map
* @return Index of matching key or -1 if not found
@@ -489,7 +489,7 @@ public class MiniMap<K, V> implements Map<K, V>, Serializable
/**
* Searches for a key from a given starting index.
- *
+ *
* @param key
* The key to find in this map
* @param start
@@ -516,7 +516,7 @@ public class MiniMap<K, V> implements Map<K, V>, Serializable
/**
* Searches for a value from a given starting index.
- *
+ *
* @param start
* Index to start at
* @param value