You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by th...@apache.org on 2014/12/06 23:30:26 UTC

[15/15] tapestry-5 git commit: Fifth pass creating the BeanModel and Commons packages. Initial testing looks good.

Fifth pass creating the BeanModel and Commons packages. Initial testing looks good.


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/696bc7ae
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/696bc7ae
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/696bc7ae

Branch: refs/heads/beanmodel-split
Commit: 696bc7ae848f4b4f2421ff77ceb4858a2f10465c
Parents: eb7ec86
Author: Thiago H. de Paula Figueiredo <th...@apache.org>
Authored: Sat Dec 6 20:29:20 2014 -0200
Committer: Thiago H. de Paula Figueiredo <th...@apache.org>
Committed: Sat Dec 6 20:29:20 2014 -0200

----------------------------------------------------------------------
 .../org/apache/tapestry5/PropertyConduit2.java  |   2 +-
 .../beaneditor/BeanModelSourceBuilder.java      | 159 ++---
 .../CoercingPropertyConduitWrapper.java         |   8 +-
 .../services/LiteralPropertyConduit.java        |   2 +-
 .../services/PropertyConduitSourceImpl.java     |  46 +-
 .../services/ClassPropertyAdapterImpl.java      |  92 +--
 .../services/AnnotationDataTypeAnalyzer.java    |  32 +
 .../ioc/internal/BasicDataTypeAnalyzers.java    | 151 +++++
 .../ioc/internal/util/InternalCommonsUtils.java | 608 +++++++++----------
 .../internal/TapestryInternalUtils.java         |   4 +-
 .../internal/bindings/AbstractBinding.java      |   2 +-
 .../internal/bindings/PropBinding.java          |   8 +-
 .../services/AnnotationDataTypeAnalyzer.java    |  32 -
 .../InternalComponentResourcesImpl.java         |   4 +-
 .../tapestry5/modules/TapestryModule.java       |  14 +-
 .../app1/components/GenericTypeDisplay.java     |  34 +-
 .../integration/app1/pages/GenericTypeDemo.java |  24 +-
 .../pages/GridWithSubmitWithContextDemo.java    |   4 +-
 .../integration/app2/base/ChildBasePage.java    |   8 +-
 .../integration/app2/base/ParentBasePage.java   |   2 +-
 .../pagelevel/OverrideMethodsTest.java          |  14 +-
 .../services/PropertyConduitSourceImplTest.java |  34 +-
 .../org/apache/tapestry5/json/JSONArray.java    |   2 +-
 .../org/apache/tapestry5/json/JSONObject.java   |   2 +-
 24 files changed, 723 insertions(+), 565 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/beanmodel/src/main/java/org/apache/tapestry5/PropertyConduit2.java
----------------------------------------------------------------------
diff --git a/beanmodel/src/main/java/org/apache/tapestry5/PropertyConduit2.java b/beanmodel/src/main/java/org/apache/tapestry5/PropertyConduit2.java
index 839d70f..1577a3d 100644
--- a/beanmodel/src/main/java/org/apache/tapestry5/PropertyConduit2.java
+++ b/beanmodel/src/main/java/org/apache/tapestry5/PropertyConduit2.java
@@ -36,5 +36,5 @@ public interface PropertyConduit2 extends PropertyConduit
      * @see java.lang.reflect.Field#getGenericType()
      * 
      */
-	Type getPropertyGenericType();
+    Type getPropertyGenericType();
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/beanmodel/src/main/java/org/apache/tapestry5/beaneditor/BeanModelSourceBuilder.java
----------------------------------------------------------------------
diff --git a/beanmodel/src/main/java/org/apache/tapestry5/beaneditor/BeanModelSourceBuilder.java b/beanmodel/src/main/java/org/apache/tapestry5/beaneditor/BeanModelSourceBuilder.java
index 8cef66e..4ac3373 100644
--- a/beanmodel/src/main/java/org/apache/tapestry5/beaneditor/BeanModelSourceBuilder.java
+++ b/beanmodel/src/main/java/org/apache/tapestry5/beaneditor/BeanModelSourceBuilder.java
@@ -15,15 +15,22 @@ package org.apache.tapestry5.beaneditor;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
 
 import javax.naming.OperationNotSupportedException;
+import javax.swing.JFrame;
 
 import org.apache.tapestry5.internal.services.BeanModelSourceImpl;
 import org.apache.tapestry5.internal.services.PropertyConduitSourceImpl;
 import org.apache.tapestry5.internal.services.StringInterner;
 import org.apache.tapestry5.internal.services.StringInternerImpl;
 import org.apache.tapestry5.ioc.Configuration;
+import org.apache.tapestry5.ioc.MessageFormatter;
+import org.apache.tapestry5.ioc.Messages;
 import org.apache.tapestry5.ioc.ObjectLocator;
+import org.apache.tapestry5.ioc.internal.BasicDataTypeAnalyzers;
 import org.apache.tapestry5.ioc.internal.BasicTypeCoercions;
 import org.apache.tapestry5.ioc.internal.services.PlasticProxyFactoryImpl;
 import org.apache.tapestry5.ioc.internal.services.PropertyAccessImpl;
@@ -31,6 +38,7 @@ import org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl;
 import org.apache.tapestry5.ioc.services.CoercionTuple;
 import org.apache.tapestry5.ioc.services.PlasticProxyFactory;
 import org.apache.tapestry5.ioc.services.PropertyAccess;
+import org.apache.tapestry5.ioc.services.PropertyAdapter;
 import org.apache.tapestry5.ioc.services.TypeCoercer;
 import org.apache.tapestry5.services.BeanModelSource;
 import org.apache.tapestry5.services.DataTypeAnalyzer;
@@ -42,80 +50,89 @@ import org.slf4j.LoggerFactory;
  * Tapestry-IoC. Usage of Tapestry-IoC is still recommended.
  */
 public class BeanModelSourceBuilder {
-	
-	private TypeCoercer typeCoercer;
-	private PropertyAccess propertyAccess;
-	private PropertyConduitSource propertyConduitSource;
-	private PlasticProxyFactory plasticProxyFactory;
-	private DataTypeAnalyzer dataTypeAnalyzer;
-	private ObjectLocator objectLocator;
-	private StringInterner stringInterner;
 
-	/**
-	 * Sets the {@link TypeCoercer} to be used.
-	 */
-	public BeanModelSourceBuilder setTypeCoercer(TypeCoercer typeCoercer) {
-		this.typeCoercer = typeCoercer;
-//		propertyAccess = new PropertyAcc
-		return this;
-	}
+    private TypeCoercer typeCoercer;
+    private PropertyAccess propertyAccess;
+    private PropertyConduitSource propertyConduitSource;
+    private PlasticProxyFactory plasticProxyFactory;
+    private DataTypeAnalyzer dataTypeAnalyzer;
+    private ObjectLocator objectLocator;
+    private StringInterner stringInterner;
 
-	public BeanModelSource build() 
-	{
-		
-		if (typeCoercer == null) 
-		{
-			createTypeCoercer();
-		}
-		
-		if (propertyAccess == null)
-		{
-			propertyAccess = new PropertyAccessImpl();
-		}
-		
-		if (stringInterner == null)
-		{
-			stringInterner = new StringInternerImpl();
-		}
-		
-		if (plasticProxyFactory == null)
-		{
-			plasticProxyFactory = new PlasticProxyFactoryImpl(getClass().getClassLoader(), LoggerFactory.getLogger(PlasticProxyFactory.class));
-		}
-		
-		if (propertyConduitSource == null)
-		{
-			propertyConduitSource = new PropertyConduitSourceImpl(propertyAccess, plasticProxyFactory, typeCoercer, stringInterner);
-		}
-		
-		return new BeanModelSourceImpl(typeCoercer, propertyAccess, propertyConduitSource, plasticProxyFactory, dataTypeAnalyzer, objectLocator);
-		
-	}
+    /**
+     * Sets the {@link TypeCoercer} to be used.
+     */
+    public BeanModelSourceBuilder setTypeCoercer(TypeCoercer typeCoercer)
+    {
+        this.typeCoercer = typeCoercer;
+        return this;
+    }
 
-	private void createTypeCoercer() {
-		CoercionTupleConfiguration configuration = new CoercionTupleConfiguration();
-		BasicTypeCoercions.provideBasicTypeCoercions(configuration);
-		typeCoercer = new TypeCoercerImpl(configuration.getTuples());
-	}
-	
-	final private static class CoercionTupleConfiguration implements Configuration<CoercionTuple> {
-		
-		final private Collection<CoercionTuple> tuples = new ArrayList<CoercionTuple>();
+    public BeanModelSource build() 
+    {
+        
+        if (typeCoercer == null) 
+        {
+            createTypeCoercer();
+        }
+        
+        if (propertyAccess == null)
+        {
+            propertyAccess = new PropertyAccessImpl();
+        }
+        
+        if (dataTypeAnalyzer == null)
+        {
+            dataTypeAnalyzer = BasicDataTypeAnalyzers.createDefaultDataTypeAnalyzer();
+        }
+        
+        if (stringInterner == null)
+        {
+            stringInterner = new StringInternerImpl();
+        }
+        
+        if (plasticProxyFactory == null)
+        {
+            plasticProxyFactory = new PlasticProxyFactoryImpl(getClass().getClassLoader(), LoggerFactory.getLogger(PlasticProxyFactory.class));
+        }
+        
+        if (propertyConduitSource == null)
+        {
+            propertyConduitSource = new PropertyConduitSourceImpl(propertyAccess, plasticProxyFactory, typeCoercer, stringInterner);
+        }
+        
+        return new BeanModelSourceImpl(typeCoercer, propertyAccess, propertyConduitSource, plasticProxyFactory, dataTypeAnalyzer, objectLocator);
+        
+    }
+    private void createTypeCoercer() 
+    {
+        CoercionTupleConfiguration configuration = new CoercionTupleConfiguration();
+        BasicTypeCoercions.provideBasicTypeCoercions(configuration);
+        typeCoercer = new TypeCoercerImpl(configuration.getTuples());
+    }
 
-		@Override
-		public void add(CoercionTuple tuble) {
-			tuples.add(tuble);
-		}
+    final private static class CoercionTupleConfiguration implements Configuration<CoercionTuple> 
+    {
+
+        final private Collection<CoercionTuple> tuples = new ArrayList<CoercionTuple>();
+
+        @Override
+        public void add(CoercionTuple tuble) 
+        {
+            tuples.add(tuble);
+        }
+
+        @Override
+        public void addInstance(Class<? extends CoercionTuple> clazz) 
+        {
+            throw new RuntimeException("Not implemented");
+        }
+
+        public Collection<CoercionTuple> getTuples() 
+        {
+            return tuples;
+        }
+
+    }
 
-		@Override
-		public void addInstance(Class<? extends CoercionTuple> clazz) {
-			throw new RuntimeException("Not implemented");
-		}
-		
-		public Collection<CoercionTuple> getTuples() {
-			return tuples;
-		}
-		
-	}
-	
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/beanmodel/src/main/java/org/apache/tapestry5/internal/services/CoercingPropertyConduitWrapper.java
----------------------------------------------------------------------
diff --git a/beanmodel/src/main/java/org/apache/tapestry5/internal/services/CoercingPropertyConduitWrapper.java b/beanmodel/src/main/java/org/apache/tapestry5/internal/services/CoercingPropertyConduitWrapper.java
index 4dbfb2d..2127696 100644
--- a/beanmodel/src/main/java/org/apache/tapestry5/internal/services/CoercingPropertyConduitWrapper.java
+++ b/beanmodel/src/main/java/org/apache/tapestry5/internal/services/CoercingPropertyConduitWrapper.java
@@ -50,10 +50,10 @@ public class CoercingPropertyConduitWrapper implements PropertyConduit2
     
     public Type getPropertyGenericType()
     {
-    	if (conduit instanceof PropertyConduit2) {
-    		return ((PropertyConduit2) conduit).getPropertyGenericType();
-    	}
-    	return conduit.getPropertyType();
+        if (conduit instanceof PropertyConduit2) {
+            return ((PropertyConduit2) conduit).getPropertyGenericType();
+        }
+        return conduit.getPropertyType();
     }
 
     @SuppressWarnings("unchecked")

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/beanmodel/src/main/java/org/apache/tapestry5/internal/services/LiteralPropertyConduit.java
----------------------------------------------------------------------
diff --git a/beanmodel/src/main/java/org/apache/tapestry5/internal/services/LiteralPropertyConduit.java b/beanmodel/src/main/java/org/apache/tapestry5/internal/services/LiteralPropertyConduit.java
index 1fffd4f..e8cd58f 100644
--- a/beanmodel/src/main/java/org/apache/tapestry5/internal/services/LiteralPropertyConduit.java
+++ b/beanmodel/src/main/java/org/apache/tapestry5/internal/services/LiteralPropertyConduit.java
@@ -63,7 +63,7 @@ public class LiteralPropertyConduit extends PropertyConduitDelegate implements I
     
     public Type getPropertyGenericType()
     {
-    	return propertyType;
+        return propertyType;
     }
 
     public <T extends Annotation> T getAnnotation(Class<T> annotationClass)

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/beanmodel/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
----------------------------------------------------------------------
diff --git a/beanmodel/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java b/beanmodel/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
index 09d234c..9148b46 100644
--- a/beanmodel/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
+++ b/beanmodel/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
@@ -524,28 +524,28 @@ public class PropertyConduitSourceImpl implements PropertyConduitSource
 
         private Type getGenericType(PropertyAdapter adapter)
         {
-        	Type genericType = null;
-        	if (adapter.getField() != null)
-        	{
-        		genericType = adapter.getField().getGenericType();
-        	}
-        	else if (adapter.getReadMethod() != null)
-        	{
-        		genericType = adapter.getReadMethod().getGenericReturnType(); 
-        	}
-        	else if (adapter.getWriteMethod() != null)
-        	{
-        		genericType = adapter.getWriteMethod().getGenericParameterTypes()[0];
-        	}
-        	else
-        	{
-        		throw new RuntimeException("Could not find accessor for property " + adapter.getName());
-        	}
-        	
-        	return genericType == null ? adapter.getType() : genericType;
-		}
-
-		private void implementSetter(PropertyAdapter adapter)
+            Type genericType = null;
+            if (adapter.getField() != null)
+            {
+                genericType = adapter.getField().getGenericType();
+            }
+            else if (adapter.getReadMethod() != null)
+            {
+                genericType = adapter.getReadMethod().getGenericReturnType(); 
+            }
+            else if (adapter.getWriteMethod() != null)
+            {
+                genericType = adapter.getWriteMethod().getGenericParameterTypes()[0];
+            }
+            else
+            {
+                throw new RuntimeException("Could not find accessor for property " + adapter.getName());
+            }
+            
+            return genericType == null ? adapter.getType() : genericType;
+        }
+
+        private void implementSetter(PropertyAdapter adapter)
         {
             if (adapter.getWriteMethod() != null)
             {
@@ -1488,7 +1488,7 @@ public class PropertyConduitSourceImpl implements PropertyConduitSource
             
             public Type getPropertyGenericType()
             {
-            	return rootClass;
+                return rootClass;
             }
 
             public <T extends Annotation> T getAnnotation(Class<T> annotationClass)

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/beanmodel/src/main/java/org/apache/tapestry5/ioc/internal/services/ClassPropertyAdapterImpl.java
----------------------------------------------------------------------
diff --git a/beanmodel/src/main/java/org/apache/tapestry5/ioc/internal/services/ClassPropertyAdapterImpl.java b/beanmodel/src/main/java/org/apache/tapestry5/ioc/internal/services/ClassPropertyAdapterImpl.java
index 5d6dfec..9c5f36c4 100644
--- a/beanmodel/src/main/java/org/apache/tapestry5/ioc/internal/services/ClassPropertyAdapterImpl.java
+++ b/beanmodel/src/main/java/org/apache/tapestry5/ioc/internal/services/ClassPropertyAdapterImpl.java
@@ -57,11 +57,11 @@ public class ClassPropertyAdapterImpl implements ClassPropertyAdapter
             // TAP5-1493
             if (readMethod != null && readMethod.isBridge())
             {
-            	if (nonBridgeMethods == null)
-            	{
-            		nonBridgeMethods = groupNonBridgeMethodsByName(beanType);
-            	}
-            	readMethod = findMethodWithSameNameAndParamCount(readMethod, nonBridgeMethods); 
+                if (nonBridgeMethods == null)
+                {
+                    nonBridgeMethods = groupNonBridgeMethodsByName(beanType);
+                }
+                readMethod = findMethodWithSameNameAndParamCount(readMethod, nonBridgeMethods); 
             }
             
             // TAP5-1548, TAP5-1885: trying to find a getter which Introspector missed
@@ -86,11 +86,11 @@ public class ClassPropertyAdapterImpl implements ClassPropertyAdapter
             
             if (writeMethod != null && writeMethod.isBridge())
             {
-            	if (nonBridgeMethods == null)
-            	{
-            		nonBridgeMethods = groupNonBridgeMethodsByName(beanType);
-            	}
-            	writeMethod = findMethodWithSameNameAndParamCount(writeMethod, nonBridgeMethods);
+                if (nonBridgeMethods == null)
+                {
+                    nonBridgeMethods = groupNonBridgeMethodsByName(beanType);
+                }
+                writeMethod = findMethodWithSameNameAndParamCount(writeMethod, nonBridgeMethods);
             }
             
             // TAP5-1548, TAP5-1885: trying to find a setter which Introspector missed
@@ -149,24 +149,24 @@ public class ClassPropertyAdapterImpl implements ClassPropertyAdapter
      *         (default to providedmethod if none found)
      */
     private Method findMethodWithSameNameAndParamCount(Method method, Map<String, List<Method>> groupedMethods) {
-    	List<Method> methodGroup = groupedMethods.get(method.getName());
-    	if (methodGroup != null)
-    	{
-    		for (Method nonBridgeMethod : methodGroup)
-    		{
-    			if (nonBridgeMethod.getParameterTypes().length == method.getParameterTypes().length)
-    			{
-    				// return the non-bridge method with the same name / argument count
-    				return nonBridgeMethod;
-    			}
-    		}
-    	}
-    	
-    	// default to the provided method
-    	return method;
-	}
-
-	/**
+        List<Method> methodGroup = groupedMethods.get(method.getName());
+        if (methodGroup != null)
+        {
+            for (Method nonBridgeMethod : methodGroup)
+            {
+                if (nonBridgeMethod.getParameterTypes().length == method.getParameterTypes().length)
+                {
+                    // return the non-bridge method with the same name / argument count
+                    return nonBridgeMethod;
+                }
+            }
+        }
+        
+        // default to the provided method
+        return method;
+    }
+
+    /**
      * Find all of the public methods that are not bridge methods and
      * group them by method name
      * 
@@ -176,24 +176,24 @@ public class ClassPropertyAdapterImpl implements ClassPropertyAdapter
      */
     private Map<String, List<Method>> groupNonBridgeMethodsByName(Class type)
     {
-    	Map<String, List<Method>> methodGroupsByName = CollectionFactory.newMap();
-    	for (Method method : type.getMethods())
-    	{
-    		if (!method.isBridge())
-    		{
-    			List<Method> methodGroup = methodGroupsByName.get(method.getName());
-    			if (methodGroup == null)
-    			{
-    				methodGroup = CollectionFactory.newList();
-    				methodGroupsByName.put(method.getName(), methodGroup);
-    			}
-    			methodGroup.add(method);
-    		}
-    	}
-    	return methodGroupsByName;
-	}
-
-	@Override
+        Map<String, List<Method>> methodGroupsByName = CollectionFactory.newMap();
+        for (Method method : type.getMethods())
+        {
+            if (!method.isBridge())
+            {
+                List<Method> methodGroup = methodGroupsByName.get(method.getName());
+                if (methodGroup == null)
+                {
+                    methodGroup = CollectionFactory.newList();
+                    methodGroupsByName.put(method.getName(), methodGroup);
+                }
+                methodGroup.add(method);
+            }
+        }
+        return methodGroupsByName;
+    }
+
+    @Override
     public Class getBeanType()
     {
         return beanType;

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/commons/src/main/java/org/apache/tapestry5/internal/services/AnnotationDataTypeAnalyzer.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/tapestry5/internal/services/AnnotationDataTypeAnalyzer.java b/commons/src/main/java/org/apache/tapestry5/internal/services/AnnotationDataTypeAnalyzer.java
new file mode 100644
index 0000000..8b20666
--- /dev/null
+++ b/commons/src/main/java/org/apache/tapestry5/internal/services/AnnotationDataTypeAnalyzer.java
@@ -0,0 +1,32 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed 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.tapestry5.internal.services;
+
+import org.apache.tapestry5.beaneditor.DataType;
+import org.apache.tapestry5.ioc.services.PropertyAdapter;
+import org.apache.tapestry5.services.DataTypeAnalyzer;
+
+/**
+ * Checks for the {@link DataType} annotation, returning its value if present.
+ */
+public class AnnotationDataTypeAnalyzer implements DataTypeAnalyzer
+{
+    public String identifyDataType(PropertyAdapter adapter)
+    {
+        DataType annotation = adapter.getAnnotation(DataType.class);
+
+        return annotation == null ? null : annotation.value();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/commons/src/main/java/org/apache/tapestry5/ioc/internal/BasicDataTypeAnalyzers.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/tapestry5/ioc/internal/BasicDataTypeAnalyzers.java b/commons/src/main/java/org/apache/tapestry5/ioc/internal/BasicDataTypeAnalyzers.java
new file mode 100644
index 0000000..df7564f
--- /dev/null
+++ b/commons/src/main/java/org/apache/tapestry5/ioc/internal/BasicDataTypeAnalyzers.java
@@ -0,0 +1,151 @@
+// Copyright 2014 The Apache Software Foundation
+//
+// Licensed 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.tapestry5.ioc.internal;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tapestry5.beaneditor.DataTypeConstants;
+import org.apache.tapestry5.internal.services.AnnotationDataTypeAnalyzer;
+import org.apache.tapestry5.ioc.MappedConfiguration;
+import org.apache.tapestry5.ioc.OrderedConfiguration;
+import org.apache.tapestry5.ioc.services.PropertyAdapter;
+import org.apache.tapestry5.services.DataTypeAnalyzer;
+
+/**
+ * Class that provides Tapestry's basic default data type analyzers.
+ */
+public class BasicDataTypeAnalyzers
+{
+    
+    public static void contributeDataTypeAnalyzer(
+            OrderedConfiguration<DataTypeAnalyzer> configuration,
+            DataTypeAnalyzer defaultDataTypeAnalyzer) {
+        configuration.add("Annotation", new AnnotationDataTypeAnalyzer());
+        if (defaultDataTypeAnalyzer == null)
+        {
+            defaultDataTypeAnalyzer = createDefaultDataTypeAnalyzer();
+        }
+        configuration.add("Default", defaultDataTypeAnalyzer, "after:*");
+    }
+
+    public static DataTypeAnalyzer createDefaultDataTypeAnalyzer() 
+    {
+        DefaultDataTypeAnalyzerMappedConfiguration mappedConfiguration = new DefaultDataTypeAnalyzerMappedConfiguration();
+        provideDefaultDataTypeAnalyzers(mappedConfiguration);
+        return new CombinedDataTypeAnalyzer(new AnnotationDataTypeAnalyzer(), new MapDataTypeAnalyzer(mappedConfiguration.getMap()));
+    }
+    
+    /**
+     * Maps property types to data type names:
+     * <ul>
+     * <li>String --&gt; text
+     * <li>Number --&gt; number
+     * <li>Enum --&gt; enum
+     * <li>Boolean --&gt; boolean
+     * <li>Date --&gt; date
+     * </ul>
+     */
+    public static void provideDefaultDataTypeAnalyzers(MappedConfiguration<Class, String> configuration)
+    {
+        // This is a special case contributed to avoid exceptions when a
+        // property type can't be
+        // matched. DefaultDataTypeAnalyzer converts the empty string to null.
+
+        configuration.add(Object.class, "");
+
+        configuration.add(String.class, DataTypeConstants.TEXT);
+        configuration.add(Number.class, DataTypeConstants.NUMBER);
+        configuration.add(Enum.class, DataTypeConstants.ENUM);
+        configuration.add(Boolean.class, DataTypeConstants.BOOLEAN);
+        configuration.add(Date.class, DataTypeConstants.DATE);
+        configuration.add(Calendar.class, DataTypeConstants.CALENDAR);
+    }
+
+    final private static class DefaultDataTypeAnalyzerMappedConfiguration implements MappedConfiguration<Class, String> 
+    {
+        
+        final Map<Class, String> map = new HashMap<Class, String>();
+
+        @Override
+        public void add(Class key, String value) {
+            map.put(key, value);
+        }
+
+        @Override
+        public void override(Class key, String value) {
+            throw new RuntimeException("Not implemented");
+        }
+
+        @Override
+        public void addInstance(Class key, Class<? extends String> clazz) {
+            throw new RuntimeException("Not implemented");            
+        }
+
+        @Override
+        public void overrideInstance(Class key, Class<? extends String> clazz) {
+            throw new RuntimeException("Not implemented");
+        }
+
+        public Map<Class, String> getMap() {
+            return map;
+        }
+        
+    }
+    
+    final private static class MapDataTypeAnalyzer implements DataTypeAnalyzer
+    {
+        
+        final Map<Class, String> map;
+
+        public MapDataTypeAnalyzer(Map<Class, String> map) {
+            this.map = map;
+        }
+
+        @Override
+        public String identifyDataType(PropertyAdapter adapter) {
+            return map.get(adapter.getType());
+        }
+        
+    }
+    
+    final private static class CombinedDataTypeAnalyzer implements DataTypeAnalyzer 
+    {
+
+        final private DataTypeAnalyzer first, second;
+
+        public CombinedDataTypeAnalyzer(DataTypeAnalyzer first, DataTypeAnalyzer second) 
+        {
+            super();
+            this.first = first;
+            this.second = second;
+        }
+
+        @Override
+        public String identifyDataType(PropertyAdapter adapter) 
+        {
+            String type = first.identifyDataType(adapter);
+            if (type == null) 
+            {
+                type = second.identifyDataType(adapter);
+            }
+            return type;
+        }
+
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/InternalCommonsUtils.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/InternalCommonsUtils.java b/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/InternalCommonsUtils.java
index 3c391e0..2bc33d8 100644
--- a/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/InternalCommonsUtils.java
+++ b/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/InternalCommonsUtils.java
@@ -33,11 +33,11 @@ import org.apache.tapestry5.ioc.internal.NullAnnotationProvider;
  */
 public class InternalCommonsUtils {
 
-	/**
-	 * @since 5.3
-	 */
-	public final static AnnotationProvider NULL_ANNOTATION_PROVIDER = new NullAnnotationProvider();
-	private static final Pattern NON_WORD_PATTERN = Pattern.compile("[^\\w]");
+    /**
+     * @since 5.3
+     */
+    public final static AnnotationProvider NULL_ANNOTATION_PROVIDER = new NullAnnotationProvider();
+    private static final Pattern NON_WORD_PATTERN = Pattern.compile("[^\\w]");
 
     /**
      * Adds a value to a specially organized map where the values are lists of objects. This somewhat simulates a map
@@ -67,322 +67,322 @@ public class InternalCommonsUtils {
         list.add(value);
     }
 
-	/**
-	 * Sniffs the object to see if it is a {@link Location} or {@link Locatable}. Returns null if null or not
-	 * convertable to a location.
-	 */
-	
-	public static Location locationOf(Object location)
-	{
-	    if (location == null)
-	        return null;
-	
-	    if (location instanceof Location)
-	        return (Location) location;
-	
-	    if (location instanceof Locatable)
-	        return ((Locatable) location).getLocation();
-	
-	    return null;
-	}
+    /**
+     * Sniffs the object to see if it is a {@link Location} or {@link Locatable}. Returns null if null or not
+     * convertable to a location.
+     */
+    
+    public static Location locationOf(Object location)
+    {
+        if (location == null)
+            return null;
+    
+        if (location instanceof Location)
+            return (Location) location;
+    
+        if (location instanceof Locatable)
+            return ((Locatable) location).getLocation();
+    
+        return null;
+    }
 
-	public static AnnotationProvider toAnnotationProvider(final Method element)
-	{
-	    if (element == null)
-	        return NULL_ANNOTATION_PROVIDER;
-	
-	    return new AnnotationProvider()
-	    {
-	        @Override
-	        public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
-	        {
-	            return element.getAnnotation(annotationClass);
-	        }
-	    };
-	}
+    public static AnnotationProvider toAnnotationProvider(final Method element)
+    {
+        if (element == null)
+            return NULL_ANNOTATION_PROVIDER;
+    
+        return new AnnotationProvider()
+        {
+            @Override
+            public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
+            {
+                return element.getAnnotation(annotationClass);
+            }
+        };
+    }
 
-	/**
-	 * Used to convert a property expression into a key that can be used to locate various resources (Blocks, messages,
-	 * etc.). Strips out any punctuation characters, leaving just words characters (letters, number and the
-	 * underscore).
-	 *
-	 * @param expression a property expression
-	 * @return the expression with punctuation removed
-	 */
-	public static String extractIdFromPropertyExpression(String expression)
-	{
-	    return replace(expression, NON_WORD_PATTERN, "");
-	}
+    /**
+     * Used to convert a property expression into a key that can be used to locate various resources (Blocks, messages,
+     * etc.). Strips out any punctuation characters, leaving just words characters (letters, number and the
+     * underscore).
+     *
+     * @param expression a property expression
+     * @return the expression with punctuation removed
+     */
+    public static String extractIdFromPropertyExpression(String expression)
+    {
+        return replace(expression, NON_WORD_PATTERN, "");
+    }
 
-	public static String replace(String input, Pattern pattern, String replacement)
-	{
-	    return pattern.matcher(input).replaceAll(replacement);
-	}
+    public static String replace(String input, Pattern pattern, String replacement)
+    {
+        return pattern.matcher(input).replaceAll(replacement);
+    }
 
-	/**
-	 * Looks for a label within the messages based on the id. If found, it is used, otherwise the name is converted to a
-	 * user presentable form.
-	 */
-	public static String defaultLabel(String id, Messages messages, String propertyExpression)
-	{
-	    String key = id + "-label";
-	
-	    if (messages.contains(key))
-	        return messages.get(key);
-	
-	    return toUserPresentable(extractIdFromPropertyExpression(InternalCommonsUtils.lastTerm(propertyExpression)));
-	}
+    /**
+     * Looks for a label within the messages based on the id. If found, it is used, otherwise the name is converted to a
+     * user presentable form.
+     */
+    public static String defaultLabel(String id, Messages messages, String propertyExpression)
+    {
+        String key = id + "-label";
+    
+        if (messages.contains(key))
+            return messages.get(key);
+    
+        return toUserPresentable(extractIdFromPropertyExpression(InternalCommonsUtils.lastTerm(propertyExpression)));
+    }
 
-	/**
-	 * Capitalizes the string, and inserts a space before each upper case character (or sequence of upper case
-	 * characters). Thus "userId" becomes "User Id", etc. Also, converts underscore into space (and capitalizes the
-	 * following word), thus "user_id" also becomes "User Id".
-	 */
-	public static String toUserPresentable(String id)
-	{
-	    StringBuilder builder = new StringBuilder(id.length() * 2);
-	
-	    char[] chars = id.toCharArray();
-	    boolean postSpace = true;
-	    boolean upcaseNext = true;
-	
-	    for (char ch : chars)
-	    {
-	        if (upcaseNext)
-	        {
-	            builder.append(Character.toUpperCase(ch));
-	            upcaseNext = false;
-	
-	            continue;
-	        }
-	
-	        if (ch == '_')
-	        {
-	            builder.append(' ');
-	            upcaseNext = true;
-	            continue;
-	        }
-	
-	        boolean upperCase = Character.isUpperCase(ch);
-	
-	        if (upperCase && !postSpace)
-	            builder.append(' ');
-	
-	        builder.append(ch);
-	
-	        postSpace = upperCase;
-	    }
-	
-	    return builder.toString();
-	}
+    /**
+     * Capitalizes the string, and inserts a space before each upper case character (or sequence of upper case
+     * characters). Thus "userId" becomes "User Id", etc. Also, converts underscore into space (and capitalizes the
+     * following word), thus "user_id" also becomes "User Id".
+     */
+    public static String toUserPresentable(String id)
+    {
+        StringBuilder builder = new StringBuilder(id.length() * 2);
+    
+        char[] chars = id.toCharArray();
+        boolean postSpace = true;
+        boolean upcaseNext = true;
+    
+        for (char ch : chars)
+        {
+            if (upcaseNext)
+            {
+                builder.append(Character.toUpperCase(ch));
+                upcaseNext = false;
+    
+                continue;
+            }
+    
+            if (ch == '_')
+            {
+                builder.append(' ');
+                upcaseNext = true;
+                continue;
+            }
+    
+            boolean upperCase = Character.isUpperCase(ch);
+    
+            if (upperCase && !postSpace)
+                builder.append(' ');
+    
+            builder.append(ch);
+    
+            postSpace = upperCase;
+        }
+    
+        return builder.toString();
+    }
 
-	/**
-	 * @since 5.3
-	 */
-	public static AnnotationProvider toAnnotationProvider(final Class element)
-	{
-	    return new AnnotationProvider()
-	    {
-	        @Override
-	        public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
-	        {
-	            return annotationClass.cast(element.getAnnotation(annotationClass));
-	        }
-	    };
-	}
+    /**
+     * @since 5.3
+     */
+    public static AnnotationProvider toAnnotationProvider(final Class element)
+    {
+        return new AnnotationProvider()
+        {
+            @Override
+            public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
+            {
+                return annotationClass.cast(element.getAnnotation(annotationClass));
+            }
+        };
+    }
 
-	/**
-	 * Pattern used to eliminate leading and trailing underscores and dollar signs.
-	 */
-	static final Pattern NAME_PATTERN = Pattern.compile("^[_|$]*([\\p{javaJavaIdentifierPart}]+?)[_|$]*$",
-	        Pattern.CASE_INSENSITIVE);
+    /**
+     * Pattern used to eliminate leading and trailing underscores and dollar signs.
+     */
+    static final Pattern NAME_PATTERN = Pattern.compile("^[_|$]*([\\p{javaJavaIdentifierPart}]+?)[_|$]*$",
+            Pattern.CASE_INSENSITIVE);
 
-	/**
-	 * Converts a method to a user presentable string consisting of the containing class name, the method name, and the
-	 * short form of the parameter list (the class name of each parameter type, shorn of the package name portion).
-	 *
-	 * @param method
-	 * @return short string representation
-	 */
-	public static String asString(Method method)
-	{
-	    StringBuilder buffer = new StringBuilder();
-	
-	    buffer.append(method.getDeclaringClass().getName());
-	    buffer.append(".");
-	    buffer.append(method.getName());
-	    buffer.append("(");
-	
-	    for (int i = 0; i < method.getParameterTypes().length; i++)
-	    {
-	        if (i > 0)
-	            buffer.append(", ");
-	
-	        String name = method.getParameterTypes()[i].getSimpleName();
-	
-	        buffer.append(name);
-	    }
-	
-	    return buffer.append(")").toString();
-	}
+    /**
+     * Converts a method to a user presentable string consisting of the containing class name, the method name, and the
+     * short form of the parameter list (the class name of each parameter type, shorn of the package name portion).
+     *
+     * @param method
+     * @return short string representation
+     */
+    public static String asString(Method method)
+    {
+        StringBuilder buffer = new StringBuilder();
+    
+        buffer.append(method.getDeclaringClass().getName());
+        buffer.append(".");
+        buffer.append(method.getName());
+        buffer.append("(");
+    
+        for (int i = 0; i < method.getParameterTypes().length; i++)
+        {
+            if (i > 0)
+                buffer.append(", ");
+    
+            String name = method.getParameterTypes()[i].getSimpleName();
+    
+            buffer.append(name);
+        }
+    
+        return buffer.append(")").toString();
+    }
 
-	/**
-	 * Strips leading "_" and "$" and trailing "_" from the name.
-	 */
-	public static String stripMemberName(String memberName)
-	{
-	    assert InternalCommonsUtils.isNonBlank(memberName);
-	    Matcher matcher = NAME_PATTERN.matcher(memberName);
-	
-	    if (!matcher.matches())
-	        throw new IllegalArgumentException(String.format("Input '%s' is not a valid Java identifier.", memberName));
-	
-	    return matcher.group(1);
-	}
+    /**
+     * Strips leading "_" and "$" and trailing "_" from the name.
+     */
+    public static String stripMemberName(String memberName)
+    {
+        assert InternalCommonsUtils.isNonBlank(memberName);
+        Matcher matcher = NAME_PATTERN.matcher(memberName);
+    
+        if (!matcher.matches())
+            throw new IllegalArgumentException(String.format("Input '%s' is not a valid Java identifier.", memberName));
+    
+        return matcher.group(1);
+    }
 
-	/**
-	 * Joins together some number of elements to form a comma separated list.
-	 */
-	public static String join(List elements)
-	{
-	    return InternalCommonsUtils.join(elements, ", ");
-	}
+    /**
+     * Joins together some number of elements to form a comma separated list.
+     */
+    public static String join(List elements)
+    {
+        return InternalCommonsUtils.join(elements, ", ");
+    }
 
-	/**
-	 * Joins together some number of elements. If a value in the list is the empty string, it is replaced with the
-	 * string "(blank)".
-	 *
-	 * @param elements
-	 *         objects to be joined together
-	 * @param separator
-	 *         used between elements when joining
-	 */
-	public static String join(List elements, String separator)
-	{
-	    switch (elements.size())
-	    {
-	        case 0:
-	            return "";
-	
-	        case 1:
-	            return elements.get(0).toString();
-	
-	        default:
-	
-	            StringBuilder buffer = new StringBuilder();
-	            boolean first = true;
-	
-	            for (Object o : elements)
-	            {
-	                if (!first)
-	                    buffer.append(separator);
-	
-	                String string = String.valueOf(o);
-	
-	                if (string.equals(""))
-	                    string = "(blank)";
-	
-	                buffer.append(string);
-	
-	                first = false;
-	            }
-	
-	            return buffer.toString();
-	    }
-	}
+    /**
+     * Joins together some number of elements. If a value in the list is the empty string, it is replaced with the
+     * string "(blank)".
+     *
+     * @param elements
+     *         objects to be joined together
+     * @param separator
+     *         used between elements when joining
+     */
+    public static String join(List elements, String separator)
+    {
+        switch (elements.size())
+        {
+            case 0:
+                return "";
+    
+            case 1:
+                return elements.get(0).toString();
+    
+            default:
+    
+                StringBuilder buffer = new StringBuilder();
+                boolean first = true;
+    
+                for (Object o : elements)
+                {
+                    if (!first)
+                        buffer.append(separator);
+    
+                    String string = String.valueOf(o);
+    
+                    if (string.equals(""))
+                        string = "(blank)";
+    
+                    buffer.append(string);
+    
+                    first = false;
+                }
+    
+                return buffer.toString();
+        }
+    }
 
-	/**
-	 * Creates a sorted copy of the provided elements, then turns that into a comma separated list.
-	 *
-	 * @return the elements converted to strings, sorted, joined with comma ... or "(none)" if the elements are null or
-	 *         empty
-	 */
-	public static String joinSorted(Collection elements)
-	{
-	    if (elements == null || elements.isEmpty())
-	        return "(none)";
-	
-	    List<String> list = CollectionFactory.newList();
-	
-	    for (Object o : elements)
-	        list.add(String.valueOf(o));
-	
-	    Collections.sort(list);
-	
-	    return join(list);
-	}
+    /**
+     * Creates a sorted copy of the provided elements, then turns that into a comma separated list.
+     *
+     * @return the elements converted to strings, sorted, joined with comma ... or "(none)" if the elements are null or
+     *         empty
+     */
+    public static String joinSorted(Collection elements)
+    {
+        if (elements == null || elements.isEmpty())
+            return "(none)";
+    
+        List<String> list = CollectionFactory.newList();
+    
+        for (Object o : elements)
+            list.add(String.valueOf(o));
+    
+        Collections.sort(list);
+    
+        return join(list);
+    }
 
-	/**
-	 * Returns true if the input is null, or is a zero length string (excluding leading/trailing whitespace).
-	 */
-	
-	public static boolean isBlank(String input)
-	{
-	    return input == null || input.length() == 0 || input.trim().length() == 0;
-	}
+    /**
+     * Returns true if the input is null, or is a zero length string (excluding leading/trailing whitespace).
+     */
+    
+    public static boolean isBlank(String input)
+    {
+        return input == null || input.length() == 0 || input.trim().length() == 0;
+    }
 
-	/**
-	 * Capitalizes a string, converting the first character to uppercase.
-	 */
-	public static String capitalize(String input)
-	{
-	    if (input.length() == 0)
-	        return input;
-	
-	    return input.substring(0, 1).toUpperCase() + input.substring(1);
-	}
+    /**
+     * Capitalizes a string, converting the first character to uppercase.
+     */
+    public static String capitalize(String input)
+    {
+        if (input.length() == 0)
+            return input;
+    
+        return input.substring(0, 1).toUpperCase() + input.substring(1);
+    }
 
-	public static boolean isNonBlank(String input)
-	{
-	    return !isBlank(input);
-	}
+    public static boolean isNonBlank(String input)
+    {
+        return !isBlank(input);
+    }
 
-	/**
-	 * Return true if the input string contains the marker for symbols that must be expanded.
-	 */
-	public static boolean containsSymbols(String input)
-	{
-	    return input.contains("${");
-	}
+    /**
+     * Return true if the input string contains the marker for symbols that must be expanded.
+     */
+    public static boolean containsSymbols(String input)
+    {
+        return input.contains("${");
+    }
 
-	/**
-	 * Searches the string for the final period ('.') character and returns everything after that. The input string is
-	 * generally a fully qualified class name, though tapestry-core also uses this method for the occasional property
-	 * expression (which is also dot separated). Returns the input string unchanged if it does not contain a period
-	 * character.
-	 */
-	public static String lastTerm(String input)
-	{
-	    assert isNonBlank(input);
-	    int dotx = input.lastIndexOf('.');
-	
-	    if (dotx < 0)
-	        return input;
-	
-	    return input.substring(dotx + 1);
-	}
+    /**
+     * Searches the string for the final period ('.') character and returns everything after that. The input string is
+     * generally a fully qualified class name, though tapestry-core also uses this method for the occasional property
+     * expression (which is also dot separated). Returns the input string unchanged if it does not contain a period
+     * character.
+     */
+    public static String lastTerm(String input)
+    {
+        assert isNonBlank(input);
+        int dotx = input.lastIndexOf('.');
+    
+        if (dotx < 0)
+            return input;
+    
+        return input.substring(dotx + 1);
+    }
 
-	/**
-	 * Extracts the string keys from a map and returns them in sorted order. The keys are converted to strings.
-	 *
-	 * @param map
-	 *         the map to extract keys from (may be null)
-	 * @return the sorted keys, or the empty set if map is null
-	 */
-	
-	public static List<String> sortedKeys(Map map)
-	{
-	    if (map == null)
-	        return Collections.emptyList();
-	
-	    List<String> keys = CollectionFactory.newList();
-	
-	    for (Object o : map.keySet())
-	        keys.add(String.valueOf(o));
-	
-	    Collections.sort(keys);
-	
-	    return keys;
-	}
+    /**
+     * Extracts the string keys from a map and returns them in sorted order. The keys are converted to strings.
+     *
+     * @param map
+     *         the map to extract keys from (may be null)
+     * @return the sorted keys, or the empty set if map is null
+     */
+    
+    public static List<String> sortedKeys(Map map)
+    {
+        if (map == null)
+            return Collections.emptyList();
+    
+        List<String> keys = CollectionFactory.newList();
+    
+        for (Object o : map.keySet())
+            keys.add(String.valueOf(o));
+    
+        Collections.sort(keys);
+    
+        return keys;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryInternalUtils.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryInternalUtils.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryInternalUtils.java
index e032975..5e4ab42 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryInternalUtils.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryInternalUtils.java
@@ -457,9 +457,9 @@ public class TapestryInternalUtils
             {
                 if (conduit instanceof PropertyConduit2)
                 {
-                	return ((PropertyConduit2) conduit).getPropertyGenericType();
+                    return ((PropertyConduit2) conduit).getPropertyGenericType();
                 }
-            	return conduit.getPropertyType();
+                return conduit.getPropertyType();
             }
             
             public Object get(Object instance)

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/tapestry-core/src/main/java/org/apache/tapestry5/internal/bindings/AbstractBinding.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/bindings/AbstractBinding.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/bindings/AbstractBinding.java
index 8e731b7..572d61a 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/bindings/AbstractBinding.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/bindings/AbstractBinding.java
@@ -71,7 +71,7 @@ public abstract class AbstractBinding extends BaseLocatable implements Binding2
      */
     public Type getBindingGenericType()
     {
-    	return getBindingType();
+        return getBindingType();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/tapestry-core/src/main/java/org/apache/tapestry5/internal/bindings/PropBinding.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/bindings/PropBinding.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/bindings/PropBinding.java
index afe63eb..da4c53e 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/bindings/PropBinding.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/bindings/PropBinding.java
@@ -111,10 +111,10 @@ public class PropBinding extends AbstractBinding implements InternalPropBinding
     @Override
     public Type getBindingGenericType()
     {
-    	if (conduit instanceof PropertyConduit2) {
-    		return ((PropertyConduit2) conduit).getPropertyGenericType();
-    	}
-    	return conduit.getPropertyType();
+        if (conduit instanceof PropertyConduit2) {
+            return ((PropertyConduit2) conduit).getPropertyGenericType();
+        }
+        return conduit.getPropertyType();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AnnotationDataTypeAnalyzer.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AnnotationDataTypeAnalyzer.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AnnotationDataTypeAnalyzer.java
deleted file mode 100644
index 8b20666..0000000
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AnnotationDataTypeAnalyzer.java
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2007 The Apache Software Foundation
-//
-// Licensed 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.tapestry5.internal.services;
-
-import org.apache.tapestry5.beaneditor.DataType;
-import org.apache.tapestry5.ioc.services.PropertyAdapter;
-import org.apache.tapestry5.services.DataTypeAnalyzer;
-
-/**
- * Checks for the {@link DataType} annotation, returning its value if present.
- */
-public class AnnotationDataTypeAnalyzer implements DataTypeAnalyzer
-{
-    public String identifyDataType(PropertyAdapter adapter)
-    {
-        DataType annotation = adapter.getAnnotation(DataType.class);
-
-        return annotation == null ? null : annotation.value();
-    }
-}

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/InternalComponentResourcesImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/InternalComponentResourcesImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/InternalComponentResourcesImpl.java
index c51c086..5d0ac16 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/InternalComponentResourcesImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/InternalComponentResourcesImpl.java
@@ -351,9 +351,9 @@ public class InternalComponentResourcesImpl extends LockSupport implements Inter
         Binding binding = getBinding(parameterName);
         Type genericType;
         if (binding instanceof Binding2) {
-        	genericType = ((Binding2) binding).getBindingGenericType();
+            genericType = ((Binding2) binding).getBindingGenericType();
         } else {
-        	genericType = binding.getBindingType();
+            genericType = binding.getBindingType();
         }
         return genericType;
     }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java
index e3902de..8a72a4d 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java
@@ -59,6 +59,7 @@ import org.apache.tapestry5.internal.util.StringRenderable;
 import org.apache.tapestry5.internal.validator.ValidatorMacroImpl;
 import org.apache.tapestry5.ioc.*;
 import org.apache.tapestry5.ioc.annotations.*;
+import org.apache.tapestry5.ioc.internal.BasicDataTypeAnalyzers;
 import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
 import org.apache.tapestry5.ioc.services.*;
 import org.apache.tapestry5.ioc.util.AvailableValues;
@@ -621,18 +622,7 @@ public final class TapestryModule
      */
     public static void contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String> configuration)
     {
-        // This is a special case contributed to avoid exceptions when a
-        // property type can't be
-        // matched. DefaultDataTypeAnalyzer converts the empty string to null.
-
-        configuration.add(Object.class, "");
-
-        configuration.add(String.class, DataTypeConstants.TEXT);
-        configuration.add(Number.class, DataTypeConstants.NUMBER);
-        configuration.add(Enum.class, DataTypeConstants.ENUM);
-        configuration.add(Boolean.class, DataTypeConstants.BOOLEAN);
-        configuration.add(Date.class, DataTypeConstants.DATE);
-        configuration.add(Calendar.class, DataTypeConstants.CALENDAR);
+        BasicDataTypeAnalyzers.provideDefaultDataTypeAnalyzers(configuration);
     }
 
     @Contribute(BeanBlockSource.class)

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/GenericTypeDisplay.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/GenericTypeDisplay.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/GenericTypeDisplay.java
index f6d2aa7..0a9365e 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/GenericTypeDisplay.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/GenericTypeDisplay.java
@@ -25,21 +25,21 @@ import org.apache.tapestry5.ioc.annotations.Inject;
  * Outputs the type and genericType of the 'value' binding in a div
  */
 public class GenericTypeDisplay {
-	@Inject
-	private ComponentResources resources;
-	
-	@Parameter(required=true, defaultPrefix=BindingConstants.LITERAL)
-	private String description;
-	
-	@Parameter(required=true)
-	private Object value;
-	
-	void afterRender(MarkupWriter writer) {
-		writer.element("div");
-		Class<?> type = resources.getBoundType("value");
-		Type genericType = resources.getBoundGenericType("value");
-		String text = String.format("description=%s,type=%s,genericType=%s", description, type.getName(), genericType.toString());
-		writer.write(text);
-		writer.end();
-	}
+    @Inject
+    private ComponentResources resources;
+    
+    @Parameter(required=true, defaultPrefix=BindingConstants.LITERAL)
+    private String description;
+    
+    @Parameter(required=true)
+    private Object value;
+    
+    void afterRender(MarkupWriter writer) {
+        writer.element("div");
+        Class<?> type = resources.getBoundType("value");
+        Type genericType = resources.getBoundGenericType("value");
+        String text = String.format("description=%s,type=%s,genericType=%s", description, type.getName(), genericType.toString());
+        writer.write(text);
+        writer.end();
+    }
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/GenericTypeDemo.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/GenericTypeDemo.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/GenericTypeDemo.java
index 8e9fdd3..4fdc57a 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/GenericTypeDemo.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/GenericTypeDemo.java
@@ -8,16 +8,16 @@ import java.util.Set;
 import org.apache.tapestry5.annotations.Property;
 
 public class GenericTypeDemo {
-	private Set<Long> setOfLongs;
-	
-	@Property
-	private Map<String, String> mapOfStrings;
-	
-	public List<List<Date>> getListOfListOfDates() {
-		throw new UnsupportedOperationException();
-	}
-	
-	public void setSetOfLongs(Set<Long> setOfLongs) {
-		throw new UnsupportedOperationException();
-	}
+    private Set<Long> setOfLongs;
+    
+    @Property
+    private Map<String, String> mapOfStrings;
+    
+    public List<List<Date>> getListOfListOfDates() {
+        throw new UnsupportedOperationException();
+    }
+    
+    public void setSetOfLongs(Set<Long> setOfLongs) {
+        throw new UnsupportedOperationException();
+    }
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/GridWithSubmitWithContextDemo.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/GridWithSubmitWithContextDemo.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/GridWithSubmitWithContextDemo.java
index 9d4a774..0aac48f 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/GridWithSubmitWithContextDemo.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/GridWithSubmitWithContextDemo.java
@@ -45,9 +45,9 @@ public class GridWithSubmitWithContextDemo
     {
         return F.flow(library.getTracks()).sort(new Comparator<Track>(){
 
-			@Override
+            @Override
             public int compare(Track arg0, Track arg1) {
-	            return arg0.getId().compareTo(arg1.getId());
+                return arg0.getId().compareTo(arg1.getId());
             }
 
         });

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/tapestry-core/src/test/java/org/apache/tapestry5/integration/app2/base/ChildBasePage.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app2/base/ChildBasePage.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app2/base/ChildBasePage.java
index 44e9aff..5a787e9 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app2/base/ChildBasePage.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app2/base/ChildBasePage.java
@@ -1,8 +1,8 @@
 package org.apache.tapestry5.integration.app2.base;
 
 public abstract class ChildBasePage extends ParentBasePage {
-	@Override
-	public String getObject() {
-		return "foobar";
-	}
+    @Override
+    public String getObject() {
+        return "foobar";
+    }
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/tapestry-core/src/test/java/org/apache/tapestry5/integration/app2/base/ParentBasePage.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app2/base/ParentBasePage.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app2/base/ParentBasePage.java
index 4030128..6c18c43 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app2/base/ParentBasePage.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app2/base/ParentBasePage.java
@@ -1,5 +1,5 @@
 package org.apache.tapestry5.integration.app2.base;
 
 public abstract class ParentBasePage {
-	public abstract Object getObject();
+    public abstract Object getObject();
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/tapestry-core/src/test/java/org/apache/tapestry5/integration/pagelevel/OverrideMethodsTest.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/pagelevel/OverrideMethodsTest.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/pagelevel/OverrideMethodsTest.java
index b612d1f..c8e7d48 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/pagelevel/OverrideMethodsTest.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/pagelevel/OverrideMethodsTest.java
@@ -9,13 +9,13 @@ public class OverrideMethodsTest extends Assert {
     /** TAP5-901 */
     @Test
     public void override_abstract_methods() {
-    	PageTester tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);
-    	try {
-	        Document doc = tester.renderPage("OverrideAbstractMethods");
-	        assertEquals("6", doc.getElementById("length").getChildMarkup());
-    	} finally {
-    		tester.shutdown();
-    	}
+        PageTester tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);
+        try {
+            Document doc = tester.renderPage("OverrideAbstractMethods");
+            assertEquals("6", doc.getElementById("length").getChildMarkup());
+        } finally {
+            tester.shutdown();
+        }
     }
 
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImplTest.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImplTest.java b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImplTest.java
index af25c62..a861883 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImplTest.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImplTest.java
@@ -167,15 +167,15 @@ public class PropertyConduitSourceImplTest extends InternalBaseTestCase
     }
 
     static class GenericBean {
-    	public List<Date> dates;
-    	public List<GenericBean> genericBeans;
-    	
-    	public List<Long> getLongs() {
-    		return Collections.emptyList();
-    	}
-    	
-    	public void setMap(Map<String, Integer> map) {
-    	}
+        public List<Date> dates;
+        public List<GenericBean> genericBeans;
+        
+        public List<Long> getLongs() {
+            return Collections.emptyList();
+        }
+        
+        public void setMap(Map<String, Integer> map) {
+        }
     }
     
     @Test
@@ -884,15 +884,15 @@ public class PropertyConduitSourceImplTest extends InternalBaseTestCase
 
         // example from Howard
         try {
-        	assertConduitPropertyType(Foo.class, "bar", Bar.class);
+            assertConduitPropertyType(Foo.class, "bar", Bar.class);
         } catch (AssertionError e) {
-        	List<Method> matches = CollectionFactory.newList();
-        	for (Method method : Foo.class.getMethods()) {
-        		if (method.getName().equals("getBar")) {
-        			matches.add(method);
-        		}
-        	}
-        	fail(String.format("%s (possible candidates %s)", e.getMessage(), matches)); 
+            List<Method> matches = CollectionFactory.newList();
+            for (Method method : Foo.class.getMethods()) {
+                if (method.getName().equals("getBar")) {
+                    matches.add(method);
+                }
+            }
+            fail(String.format("%s (possible candidates %s)", e.getMessage(), matches)); 
         }
         assertConduitPropertyType(AbstractFoo.class, "bar", AbstractBar.class);
         

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONArray.java
----------------------------------------------------------------------
diff --git a/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONArray.java b/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONArray.java
index 76ea531..7cb7d55 100644
--- a/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONArray.java
+++ b/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONArray.java
@@ -386,7 +386,7 @@ public final class JSONArray extends JSONCollection implements Iterable<Object>
      */
     public JSONArray put(Object value)
     {
-    	// now testValidity checks for null values.
+        // now testValidity checks for null values.
         // assert value != null;
 
         JSONObject.testValidity(value);

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/696bc7ae/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONObject.java
----------------------------------------------------------------------
diff --git a/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONObject.java b/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONObject.java
index 7c5ccb4..1392bb8 100644
--- a/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONObject.java
+++ b/tapestry-json/src/main/java/org/apache/tapestry5/json/JSONObject.java
@@ -913,7 +913,7 @@ public final class JSONObject extends JSONCollection
      */
     static void printValue(JSONPrintSession session, Object value)
     {
-    	
+        
         if (value instanceof JSONObject)
         {
             ((JSONObject) value).print(session);