Author: ivaynberg
Date: Tue Aug 11 16:28:05 2009
New Revision: 803191
URL: http://svn.apache.org/viewvc?rev=803191&view=rev
Log:
WICKET-2374 Model's factory methods are inconsistent
Issue: WICKET-2374
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/model/Model.java
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/model/Model.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/model/Model.java?rev=803191&r1=803190&r2=803191&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/model/Model.java
(original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/model/Model.java Tue
Aug 11 16:28:05 2009
@@ -16,21 +16,14 @@
*/
package org.apache.wicket.model;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
import org.apache.wicket.Component;
import org.apache.wicket.WicketRuntimeException;
-import org.apache.wicket.model.util.MapModel;
-import org.apache.wicket.model.util.WildcardCollectionModel;
-import org.apache.wicket.model.util.WildcardListModel;
-import org.apache.wicket.model.util.WildcardSetModel;
+import org.apache.wicket.model.util.*;
import org.apache.wicket.util.lang.Objects;
+import java.io.Serializable;
+import java.util.*;
+
/**
* <code>Model</code> is the basic implementation of an <code>IModel</code>.
It just wraps a simple
@@ -107,14 +100,31 @@
* model type
* @param list
* The List, which may or may not be Serializable
+ * @deprecated see {...@link Model#ofList(List)}
* @return A Model object wrapping the List
*/
+ @Deprecated
public static <C> IModel<List<? extends C>> of(final List<? extends C>
list)
{
return new WildcardListModel<C>(list);
}
/**
+ * Factory method for models that contain lists. This factory method
will automatically rebuild
+ * a nonserializable <code>list</code> into a serializable one.
+ *
+ * @param <C>
+ * model type
+ * @param list
+ * The List, which may or may not be Serializable
+ * @return A Model object wrapping the List
+ */
+ public static <C> IModel<List<? extends C>> ofList(final List<? extends
C> list)
+ {
+ return new WildcardListModel<C>(list);
+ }
+
+ /**
* Factory method for models that contain maps. This factory method
will automatically rebuild a
* nonserializable <code>map</code> into a serializable one.
*
@@ -160,14 +170,31 @@
* model type
* @param set
* The Set, which may or may not be Serializable
+ * @deprecated replace by {...@link Model#ofSet(java.util.Set)}.
* @return A Model object wrapping the Set
*/
+ @Deprecated
public static <C> IModel<Set<? extends C>> of(final Set<? extends C>
set)
{
return new WildcardSetModel<C>(set);
}
/**
+ * Factory method for models that contain sets. This factory method
will automatically rebuild a
+ * nonserializable <code>set</code> into a serializable one.
+ *
+ * @param <C>
+ * model type
+ * @param set
+ * The Set, which may or may not be Serializable
+ * @return A Model object wrapping the Set
+ */
+ public static <C> IModel<Set<? extends C>> ofSet(final Set<? extends C>
set)
+ {
+ return new WildcardSetModel<C>(set);
+ }
+
+ /**
* Factory method for models that contain collections. This factory
method will automatically
* rebuild a nonserializable <code>collection</code> into a
serializable {...@link ArrayList}.
*