You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jd...@apache.org on 2009/12/22 17:36:38 UTC

svn commit: r893226 - /wicket/trunk/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java

Author: jdonnerstag
Date: Tue Dec 22 16:36:38 2009
New Revision: 893226

URL: http://svn.apache.org/viewvc?rev=893226&view=rev
Log:
WICKET-2619 fixed wicket should handle Enums like other primitives when injecting them.

Modified:
    wicket/trunk/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java

Modified: wicket/trunk/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java?rev=893226&r1=893225&r2=893226&view=diff
==============================================================================
--- wicket/trunk/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java (original)
+++ wicket/trunk/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java Tue Dec 22 16:36:38 2009
@@ -103,10 +103,10 @@
 	/**
 	 * Primitive java types and their object wrappers
 	 */
-	private static final List< ? > PRIMITIVES = Arrays.asList(new Class[] { String.class,
-			byte.class, Byte.class, short.class, Short.class, int.class, Integer.class, long.class,
-			Long.class, float.class, Float.class, double.class, Double.class, char.class,
-			Character.class, boolean.class, Boolean.class });
+	private static final List<?> PRIMITIVES = Arrays.asList(new Class[] { String.class, byte.class,
+			Byte.class, short.class, Short.class, int.class, Integer.class, long.class, Long.class,
+			float.class, Float.class, double.class, Double.class, char.class, Character.class,
+			boolean.class, Boolean.class });
 
 	/**
 	 * Create a lazy init proxy for the specified type. The target object will be located using the
@@ -120,9 +120,9 @@
 	 * 
 	 * @return lazily initializable proxy
 	 */
-	public static Object createProxy(Class< ? > type, IProxyTargetLocator locator)
+	public static Object createProxy(final Class<?> type, final IProxyTargetLocator locator)
 	{
-		if (PRIMITIVES.contains(type))
+		if (PRIMITIVES.contains(type) || Enum.class.isAssignableFrom(type))
 		{
 			// We special-case primitives as sometimes people use these as
 			// SpringBeans (WICKET-603, WICKET-906). Go figure.
@@ -226,7 +226,7 @@
 
 		private Object readResolve() throws ObjectStreamException
 		{
-			Class< ? > clazz;
+			Class<?> clazz;
 			try
 			{
 				clazz = Class.forName(type);
@@ -272,7 +272,7 @@
 		 * @param locator
 		 *            object locator used to locate the object this proxy represents
 		 */
-		public CGLibInterceptor(Class< ? > type, IProxyTargetLocator locator)
+		public CGLibInterceptor(Class<?> type, IProxyTargetLocator locator)
 		{
 			super();
 			typeName = type.getName();
@@ -367,7 +367,7 @@
 		 * @param locator
 		 *            object locator used to locate the object this proxy represents
 		 */
-		public JdkHandler(Class< ? > type, IProxyTargetLocator locator)
+		public JdkHandler(Class<?> type, IProxyTargetLocator locator)
 		{
 			super();
 			this.locator = locator;