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/27 07:10:47 UTC

svn commit: r651884 - in /wicket/trunk/wicket/src/main/java/org/apache/wicket: markup/html/list/Loop.java util/lang/Generics.java

Author: ivaynberg
Date: Sat Apr 26 22:10:38 2008
New Revision: 651884

URL: http://svn.apache.org/viewvc?rev=651884&view=rev
Log:
missing checkin

Added:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/Generics.java   (with props)
Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/Loop.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/Loop.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/Loop.java?rev=651884&r1=651883&r2=651884&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/Loop.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/Loop.java Sat Apr 26 22:10:38 2008
@@ -49,6 +49,7 @@
 	 * 
 	 * @author Jonathan Locke
 	 */
+	// FIXME 1.5: store iteration in the model instead of taking up a slot in a field
 	public static class LoopItem extends WebMarkupContainer
 	{
 		private static final long serialVersionUID = 1L;

Added: wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/Generics.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/Generics.java?rev=651884&view=auto
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/Generics.java (added)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/Generics.java Sat Apr 26 22:10:38 2008
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.util.lang;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+
+/**
+ * Generics related utilities
+ * 
+ * @author igor.vaynberg
+ */
+public class Generics
+{
+	private Generics()
+	{
+
+	}
+
+	/**
+	 * Silences generics warning when need to cast iterator types
+	 * 
+	 * @param <T>
+	 * @param delegate
+	 * @return <code>delegate</code> iterator cast to proper generics type
+	 */
+	@SuppressWarnings("unchecked")
+	public static <T> Iterator<T> iterator(Iterator< ? > delegate)
+	{
+		return (Iterator<T>)delegate;
+	}
+
+	/**
+	 * Supresses generics warning when converting model types
+	 * 
+	 * @param <T>
+	 * @param model
+	 * @return <code>model</code>
+	 */
+	@SuppressWarnings("unchecked")
+	public static <T> IModel<T> model(Model< ? > model)
+	{
+		return (IModel<T>)model;
+	}
+
+	/**
+	 * Creates a new HashMap
+	 * 
+	 * @param <K>
+	 * @param <V>
+	 * @return
+	 */
+	public static <K, V> HashMap<K, V> newHashMap()
+	{
+		return new HashMap<K, V>();
+	}
+
+}

Propchange: wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/Generics.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain