You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2008/04/15 20:32:02 UTC

svn commit: r648365 - /wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java

Author: ivaynberg
Date: Tue Apr 15 11:31:43 2008
New Revision: 648365

URL: http://svn.apache.org/viewvc?rev=648365&view=rev
Log:
generics fix

Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java?rev=648365&r1=648364&r2=648365&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java Tue Apr 15 11:31:43 2008
@@ -1216,12 +1216,16 @@
 	/**
 	 * Finds the first container parent of this component of the given class.
 	 * 
+	 * @param <Z>
+	 *            <code>class</code> of parent component
+	 * 
 	 * @param c
 	 *            MarkupContainer class to search for
 	 * @return First container parent that is an instance of the given class, or null if none can be
 	 *         found
 	 */
-	public final MarkupContainer< ? > findParent(final Class< ? extends MarkupContainer> c)
+	@SuppressWarnings("unchecked")
+	public final <Z extends MarkupContainer< ? >> Z findParent(final Class<Z> c)
 	{
 		// Start with immediate parent
 		MarkupContainer< ? > current = parent;
@@ -1232,7 +1236,7 @@
 			// Is current an instance of this class?
 			if (c.isInstance(current))
 			{
-				return current;
+				return (Z)current;
 			}
 
 			// Check parent