Author: jcompagner
Date: Mon Apr 14 02:05:36 2008
New Revision: 647707
URL: http://svn.apache.org/viewvc?rev=647707&view=rev
Log:
some more generics
IVisitor is an bit of a problem...
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/PropertyResolver.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/version/undo/ChangeList.java
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java?rev=647707&r1=647706&r2=647707&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java
(original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java
Mon Apr 14 02:05:36 2008
@@ -119,8 +119,8 @@
/**
* Adds a child component to this container.
*
- * @param child
- * The child
+ * @param childs
+ * The child(s)
* @throws IllegalArgumentException
* Thrown if a child with the same id is replaced by the
add operation.
* @return This
@@ -468,6 +468,7 @@
* The comparator
* @return Iterator that iterates over children in the order specified
by comparator
*/
+ @SuppressWarnings("unchecked")
public final Iterator<Component< ? >> iterator(Comparator<Component< ?
>> comparator)
{
final List<Component< ? >> sorted;
@@ -827,7 +828,8 @@
* @return The return value from a visitor which halted the traversal,
or null if the entire
* traversal occurred
*/
- public final Object visitChildren(final Class< ? > clazz, final
IVisitor visitor)
+ public final Object visitChildren(final Class< ? > clazz,
+ final IVisitor< ? extends Component< ? >> visitor)
{
if (visitor == null)
{
@@ -841,11 +843,13 @@
final Component< ? > child = children_get(i);
Object value = null;
+ IVisitor vis = visitor;
+
// Is the child of the correct class (or was no class
specified)?
if (clazz == null || clazz.isInstance(child))
{
// Call visitor
- value = visitor.component(child);
+ value = vis.component(child);
// If visitor returns a non-null value, it
halts the traversal
if ((value != IVisitor.CONTINUE_TRAVERSAL) &&
@@ -883,7 +887,7 @@
* @return The return value from a visitor which halted the traversal,
or null if the entire
* traversal occurred
*/
- public final Object visitChildren(final IVisitor< ? > visitor)
+ public final Object visitChildren(final IVisitor<Component< ? >>
visitor)
{
return visitChildren(null, visitor);
}
@@ -956,7 +960,7 @@
/**
*
* @param index
- * @return
+ * @return The child component
*/
private final Component< ? > children_get(int index)
{
@@ -972,7 +976,7 @@
* @param reconstruct
* @param parent
* @param index
- * @return
+ * @return The object directly or the reconstructed component
*/
private final Object postprocess(Object object, boolean reconstruct,
MarkupContainer< ? > parent, int index)
@@ -988,7 +992,7 @@
*
* @param index
* @param reconstruct
- * @return
+ * @return the child component
*/
private final Object children_get(int index, boolean reconstruct)
{
@@ -1034,7 +1038,7 @@
* [EMAIL PROTECTED] ComponentSourceEntry}
*
* @param object
- * @return
+ * @return The id of the object (object can be component or
componentsourcentry)
*/
private final String getId(Object object)
{
@@ -1055,7 +1059,7 @@
/**
*
* @param id
- * @return
+ * @return The child component
*/
private final Component< ? > children_get(final String id)
{
@@ -1108,7 +1112,7 @@
/**
*
* @param child
- * @return
+ * @return The index of the given child component
*/
private final int children_indexOf(Component< ? > child)
{
@@ -1152,7 +1156,7 @@
/**
*
* @param component
- * @return
+ * @return The component that is removed.
*/
private final Component< ? > children_remove(Component< ? > component)
{
@@ -1167,7 +1171,7 @@
/**
*
* @param index
- * @return
+ * @return The component that is removed
*/
private final Component< ? > children_remove(int index)
{
@@ -1227,7 +1231,7 @@
* @param index
* @param child
* @param reconstruct
- * @return
+ * @return The replaced child
*/
private final Object children_set(int index, Object child, boolean
reconstruct)
{
@@ -1264,7 +1268,7 @@
*
* @param index
* @param child
- * @return
+ * @return The component that is replaced
*/
private final Component< ? > children_set(int index, Component< ? >
child)
{
@@ -1273,7 +1277,7 @@
/**
*
- * @return
+ * @return The size of the children
*/
private final int children_size()
{
@@ -1640,8 +1644,7 @@
}
/**
- *
- * @return
+ * @return a copy of the children array.
*/
private Component< ? >[] copyChildren()
{
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java?rev=647707&r1=647706&r2=647707&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java
Mon Apr 14 02:05:36 2008
@@ -41,7 +41,7 @@
private final FileItem item;
- private transient List/* <InputStream> */inputStreamsToClose;
+ private transient List<InputStream> inputStreamsToClose;
/**
* Constructor
@@ -66,10 +66,9 @@
{
if (inputStreamsToClose != null)
{
- for (Iterator inputStreamsIterator =
inputStreamsToClose.iterator(); inputStreamsIterator
- .hasNext();)
+ for (Iterator<InputStream> inputStreamsIterator =
inputStreamsToClose.iterator(); inputStreamsIterator.hasNext();)
{
- InputStream inputStream =
(InputStream)inputStreamsIterator.next();
+ InputStream inputStream =
inputStreamsIterator.next();
try
{
@@ -136,7 +135,7 @@
{
if (inputStreamsToClose == null)
{
- inputStreamsToClose = new ArrayList/* <InputStream>
*/();
+ inputStreamsToClose = new ArrayList<InputStream>();
}
InputStream is = item.getInputStream();
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java?rev=647707&r1=647706&r2=647707&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java
Mon Apr 14 02:05:36 2008
@@ -42,6 +42,7 @@
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.protocol.http.SecondLevelCacheSessionStore.IPageStore;
import
org.apache.wicket.protocol.http.SecondLevelCacheSessionStore.ISerializationAwarePageStore;
+import
org.apache.wicket.protocol.http.pagestore.AbstractPageStore.SerializedPage;
import org.apache.wicket.protocol.http.pagestore.PageWindowManager.PageWindow;
import
org.apache.wicket.protocol.http.pagestore.SerializedPagesCache.SerializedPageWithSession;
import org.apache.wicket.util.lang.Bytes;
@@ -110,7 +111,7 @@
private static final long serialVersionUID = 1L;
private String sessionId;
- private final List pageMapEntryList = new ArrayList();
+ private final List<PageMapEntry> pageMapEntryList = new
ArrayList<PageMapEntry>();
private transient DiskPageStore diskPageStore;
protected SessionEntry(DiskPageStore diskPageStore)
@@ -132,9 +133,9 @@
public int getTotalSize()
{
int result = 0;
- for (Iterator i = pageMapEntryList.iterator();
i.hasNext();)
+ for (Iterator<PageMapEntry> i =
pageMapEntryList.iterator(); i.hasNext();)
{
- PageMapEntry entry = (PageMapEntry)i.next();
+ PageMapEntry entry = i.next();
if (entry.manager != null)
{
result += entry.manager.getTotalSize();
@@ -146,7 +147,7 @@
/**
* @return list of [EMAIL PROTECTED] PageMapEntry} for this
session
*/
- public List /* <PageMapEntry> */getPageMapEntryList()
+ public List /* <PageMapEntry>
*/<PageMapEntry>getPageMapEntryList()
{
return Collections.unmodifiableList(pageMapEntryList);
}
@@ -162,9 +163,9 @@
public PageMapEntry getPageMapEntry(String pageMapName, boolean
create)
{
PageMapEntry result = null;
- for (Iterator i = pageMapEntryList.iterator();
i.hasNext();)
+ for (Iterator<PageMapEntry> i =
pageMapEntryList.iterator(); i.hasNext();)
{
- PageMapEntry entry = (PageMapEntry)i.next();
+ PageMapEntry entry = i.next();
if (entry.pageMapName == pageMapName ||
(entry.pageMapName != null &&
entry.pageMapName.equals(pageMapName)))
{
@@ -234,7 +235,7 @@
while (getTotalSize() >
diskPageStore.getMaxSizePerSession() &&
pageMapEntryList.size() > 1)
{
-
removePageMapEntry((PageMapEntry)pageMapEntryList.get(0));
+
removePageMapEntry(pageMapEntryList.get(0));
}
// take the filechannel from the pool
@@ -340,7 +341,7 @@
{
while (pageMapEntryList.size() > 0)
{
-
removePageMapEntry((PageMapEntry)pageMapEntryList.get(pageMapEntryList.size() -
1));
+
removePageMapEntry(pageMapEntryList.get(pageMapEntryList.size() - 1));
}
File sessionFolder =
diskPageStore.getSessionFolder(sessionId, false);
if (sessionFolder.exists())
@@ -526,7 +527,7 @@
InputStream stream = new FileInputStream(index);
ObjectInputStream ois = new
ObjectInputStream(stream);
Map map = (Map)ois.readObject();
- sessionIdToEntryMap = new
ConcurrentHashMap(map);
+ sessionIdToEntryMap = new
ConcurrentHashMap<String, SessionEntry>(map);
for (Iterator entries =
sessionIdToEntryMap.entrySet().iterator(); entries.hasNext();)
{
// initialize the diskPageStore
reference
@@ -644,7 +645,7 @@
}
}
- private Map /* <String, SessionEntry> */sessionIdToEntryMap = new
ConcurrentHashMap();
+ private Map /* <String, SessionEntry> */<String,
SessionEntry>sessionIdToEntryMap = new ConcurrentHashMap<String,
SessionEntry>();
/**
* Returns the SessionEntry for session with given id. If the entry
does not yet exist and the
@@ -656,12 +657,12 @@
*/
protected SessionEntry getSessionEntry(String sessionId, boolean
createIfDoesNotExist)
{
- SessionEntry entry =
(SessionEntry)sessionIdToEntryMap.get(sessionId);
+ SessionEntry entry = sessionIdToEntryMap.get(sessionId);
if (entry == null && createIfDoesNotExist)
{
synchronized (sessionIdToEntryMap)
{
- entry =
(SessionEntry)sessionIdToEntryMap.get(sessionId);
+ entry = sessionIdToEntryMap.get(sessionId);
if (entry == null)
{
entry = new SessionEntry(this);
@@ -821,7 +822,7 @@
*/
public void unbind(String sessionId)
{
- SessionEntry entry =
(SessionEntry)sessionIdToEntryMap.get(sessionId);
+ SessionEntry entry = sessionIdToEntryMap.get(sessionId);
if (entry != null)
{
if (isSynchronous())
@@ -843,10 +844,10 @@
// map from session id to serialized page list
// this contains lists for all active sessions
- private final Map /* <String, List<SerializedPage>> */pagesToSaveAll =
new ConcurrentHashMap();
+ private final Map /* <String, List<SerializedPage>> */<String,
List>pagesToSaveAll = new ConcurrentHashMap<String, List>();
// contains list of serialized pages to be saved - only non empty lists
- private final Map /* <String, List<SerializedPage>> */pagesToSaveActive
= new ConcurrentHashMap();
+ private final Map /* <String, List<SerializedPage>> */<String,
List>pagesToSaveActive = new ConcurrentHashMap<String, List>();
/**
* Returns the list of pages to be saved for the specified session id.
If the list is not found,
@@ -857,12 +858,12 @@
*/
protected List getPagesToSaveList(String sessionId)
{
- List list = (List)pagesToSaveAll.get(sessionId);
+ List list = pagesToSaveAll.get(sessionId);
if (list == null)
{
synchronized (pagesToSaveAll)
{
- list = (List)pagesToSaveAll.get(sessionId);
+ list = pagesToSaveAll.get(sessionId);
if (list == null)
{
list = new ArrayList();
@@ -1065,7 +1066,7 @@
*/
private SerializedPageWithSession
stripSerializedPage(SerializedPageWithSession page)
{
- List pages = new ArrayList(page.pages.size());
+ List<SerializedPage> pages = new
ArrayList<SerializedPage>(page.pages.size());
for (Iterator i = page.pages.iterator(); i.hasNext();)
{
SerializedPage sp = (SerializedPage)i.next();
@@ -1116,7 +1117,7 @@
*/
private SerializedPageWithSession
restoreStrippedSerializedPage(SerializedPageWithSession page)
{
- List pages = new ArrayList(page.pages.size());
+ List<SerializedPage> pages = new
ArrayList<SerializedPage>(page.pages.size());
for (Iterator i = page.pages.iterator(); i.hasNext();)
{
SerializedPage sp = (SerializedPage)i.next();
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/PropertyResolver.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/PropertyResolver.java?rev=647707&r1=647706&r2=647707&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/PropertyResolver.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/PropertyResolver.java
Mon Apr 14 02:05:36 2008
@@ -1009,7 +1009,7 @@
return null;
}
- Class clz = getMethod.getReturnType();
+ Class<?> clz = getMethod.getReturnType();
Object value = null;
try
{
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/version/undo/ChangeList.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/version/undo/ChangeList.java?rev=647707&r1=647706&r2=647707&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/version/undo/ChangeList.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/version/undo/ChangeList.java
Mon Apr 14 02:05:36 2008
@@ -39,7 +39,7 @@
private static final Logger log =
LoggerFactory.getLogger(ChangeList.class);
/** the list of changes */
- private final List changes = new ArrayList();
+ private final List<Change> changes = new ArrayList<Change>();
/**
* A <code>Component</code> was added.
@@ -109,7 +109,7 @@
// Go through changes in reverse time order to undo.
for (int i = changes.size() - 1; i >= 0; i--)
{
- ((Change)changes.get(i)).undo();
+ changes.get(i).undo();
}
}