ibatis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gba...@apache.org
Subject svn commit: r703678 [1/3] - in /ibatis/trunk/cs/V3/src: Apache.Ibatis.Common/Contracts/Constraints/ Apache.Ibatis.Common/Data/ Apache.Ibatis.Common/Logging/ Apache.Ibatis.Common/Utilities/ Apache.Ibatis.Common/Utilities/Objects/ Apache.Ibatis.Common/Ut...
Date Sat, 11 Oct 2008 16:07:47 GMT
Author: gbayon
Date: Sat Oct 11 09:07:44 2008
New Revision: 703678

URL: http://svn.apache.org/viewvc?rev=703678&view=rev
Log:
Cleaning code

Added:
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/Mapping/IterateTest.cs   (with props)
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Maps/Iterate.xml
Modified:
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/CompositeConstraint.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/EqualConstraint.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/NegationBuilder.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/SameAs.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Data/DbProvider.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Data/DbProviderFactory.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Logging/LogManager.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/ConfigWatcherHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/HashCodeProvider.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/AbstractFactory.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/BoxingOpCodes.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/DelegateFactory.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/DelegateObjectFactory.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/EmitObjectFactory.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/FactoryBuilder.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/FactoryLogAdapter.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/AccessorFactory.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegateGetFieldAccessor.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegatePropertyGetAccessor.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegatePropertySetAccessor.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegateSetFieldAccessor.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitFieldGetAccessor.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitFieldSetAccessor.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitPropertyGetAccessor.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitPropertySetAccessor.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/GetAccessorFactory.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionFieldGetAccessor.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionFieldSetAccessor.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionPropertyGetAccessor.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionPropertySetAccessor.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/SetAccessorFactory.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ObjectFactory.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ObjectProbe.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ReflectionInfo.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/ReadOnlyDictionary.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/StringTokenizer.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/TypeUtils.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/TypesResolver/CachedTypeResolver.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/TypesResolver/TypeResolver.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Xml/NodeUtils.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Apache.Ibatis.DataMapper.SqlClient.Test.2005.csproj
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Domain/Account.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/Mapping/DynamicTest.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Maps/DynamicAccount.xml
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/bin/Debug/SqlMap.config
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildStatements.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Data/DBHelperParameterCache.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/DataExchange/BaseDataExchange.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/DataExchange/ComplexDataExchange.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/DataExchange/DataExchangeFactory.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/DataExchange/DictionaryDataExchange.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/DataExchange/DotNetObjectDataExchange.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/DataExchange/ListDataExchange.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/DataExchange/PrimitiveDataExchange.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/DefaultMapperFactory.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/BaseStrategy.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/MappedStatementEventSupport.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PostBindind.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/CircularStrategy.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/ReaderAutoMapper.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/ResultStrategy/CirularStrategy.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ParameterMapping/InlineParameterMapParser.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ParameterMapping/InlineParemeterMapBuilder.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Sql/Dynamic/DynamicSql.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Scope/RequestScope.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/AnsiStringTypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/BaseTypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/ByteArrayTypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/CustomTypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/Nullables/NullableBooleanTypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/Nullables/NullableByteTypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/Nullables/NullableCharTypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/Nullables/NullableDateTimeTypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/Nullables/NullableDecimalTypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/Nullables/NullableDoubleTypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/Nullables/NullableGuidTypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/Nullables/NullableInt16TypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/Nullables/NullableInt32TypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/Nullables/NullableInt64TypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/Nullables/NullableSByteTypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/Nullables/NullableSingleTypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/Nullables/NullableTimeSpanTypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/Nullables/NullableUInt16TypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/Nullables/NullableUInt32TypeHandler.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/TypeHandlers/Nullables/NullableUInt64TypeHandler.cs

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/CompositeConstraint.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/CompositeConstraint.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/CompositeConstraint.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/CompositeConstraint.cs Sat Oct 11 09:07:44 2008
@@ -39,7 +39,7 @@
         /// </summary>
         /// <param name="left">The left side.</param>
         /// <param name="right">The right side.</param>
-        public CompositeConstraint(
+        protected CompositeConstraint(
             BaseConstraint left, 
             BaseConstraint right)
         {

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/EqualConstraint.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/EqualConstraint.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/EqualConstraint.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/EqualConstraint.cs Sat Oct 11 09:07:44 2008
@@ -70,7 +70,7 @@
             return test;
         }
 
-        private bool CheckEquality(object expected, object actual)
+        private static bool CheckEquality(object expected, object actual)
         {
             if ((expected == null) && (actual == null))
             {

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/NegationBuilder.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/NegationBuilder.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/NegationBuilder.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/NegationBuilder.cs Sat Oct 11 09:07:44 2008
@@ -130,7 +130,7 @@
             get { return this; }
         }
         
-        private BaseConstraint Resolve(BaseConstraint constraint)
+        private static BaseConstraint Resolve(BaseConstraint constraint)
         {
             return new NotConstraint(constraint);
         }

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/SameAs.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/SameAs.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/SameAs.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Contracts/Constraints/SameAs.cs Sat Oct 11 09:07:44 2008
@@ -52,8 +52,8 @@
         /// </returns>
         public override bool IsSatisfiedBy(object actual, AppendErrorMessage appendErrorMessage)
         {
-            bool test = ((actual != null) && object.ReferenceEquals(this.expected, actual));
-            ErrorMessage = NegationMessage + "be same as " + expected.ToString();
+            bool test = ((actual != null) && ReferenceEquals(expected, actual));
+            ErrorMessage = NegationMessage + "be same as " + expected;
 
             if (!test)
             {

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Data/DbProvider.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Data/DbProvider.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Data/DbProvider.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Data/DbProvider.cs Sat Oct 11 09:07:44 2008
@@ -411,7 +411,7 @@
 			get { return _parameterPrefix; }
 			set 
 			{ 
-				if ((value == null) || (value.Length < 1))
+				if (string.IsNullOrEmpty(value))
 				{
 					_parameterPrefix = ""; 
 				}
@@ -586,9 +586,9 @@
 			if ((obj != null) && (obj is IDbProvider))
 			{
 				IDbProvider that = (IDbProvider) obj;
-				return ((this.id == that.Id) && 
-					(this._assemblyName == that.AssemblyName) &&
-					(this._connectionClass == that.DbConnectionClass));
+				return ((id == that.Id) && 
+					(_assemblyName == that.AssemblyName) &&
+					(_connectionClass == that.DbConnectionClass));
 			}
 			return false;
 		}
@@ -611,7 +611,7 @@
 			return "Provider " + id;
 		}
 
-		private void CheckPropertyString(string propertyName, string value)
+		private static void CheckPropertyString(string propertyName, string value)
 		{
 			if (value == null || value.Trim().Length == 0)
 			{
@@ -621,7 +621,7 @@
 			}
 		}
 
-		private void CheckPropertyType(string propertyName,Type expectedType, Type value)
+		private static void CheckPropertyType(string propertyName,Type expectedType, Type value)
 		{
 			if (value == null)
 			{

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Data/DbProviderFactory.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Data/DbProviderFactory.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Data/DbProviderFactory.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Data/DbProviderFactory.cs Sat Oct 11 09:07:44 2008
@@ -69,7 +69,7 @@
                         }
                         else
                         {
-                            throw new CommonExceptions.ConfigurationException(
+                            throw new ConfigurationException(
                                 string.Format("Error while configuring the Provider named \"{0}\" There can be only one default Provider.", provider.Id));
                         }
                     }
@@ -93,11 +93,7 @@
             {
                 return repository[providerInvariantName];
             }
-            else
-            {
-                throw new ConfigurationException("There's no provider with the name '" + providerInvariantName + "'. Cause you give a wrong name or the provider is disabled in the providers.config file.");
-            }
+            throw new ConfigurationException("There's no provider with the name '" + providerInvariantName + "'. Cause you give a wrong name or the provider is disabled in the providers.config file.");
         }
-
     }
 }

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Logging/LogManager.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Logging/LogManager.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Logging/LogManager.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Logging/LogManager.cs Sat Oct 11 09:07:44 2008
@@ -38,7 +38,7 @@
 	{
 		private static ILoggerFactoryAdapter _adapter = null;
 		private static readonly object _loadLock = new object();
-		private static readonly string IBATIS_SECTION_LOGGING = "iBATIS/logging";
+		private const string IBATIS_SECTION_LOGGING = "iBATIS/logging";
 
         /// <summary>
         /// Initializes the <see cref="LogManager"/> class.

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/ConfigWatcherHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/ConfigWatcherHandler.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/ConfigWatcherHandler.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/ConfigWatcherHandler.cs Sat Oct 11 09:07:44 2008
@@ -25,7 +25,6 @@
 #endregion
 
 using System.Collections;
-using System.Collections.Specialized;
 using System.IO;
 using System.Threading;
 using Apache.Ibatis.Common.Logging;
@@ -79,17 +78,17 @@
 		/// <summary>
 		/// The timer used to compress the notification events.
 		/// </summary>
-		private Timer _timer = null;
+		private readonly Timer _timer = null;
 
 		/// <summary>
 		/// A list of configuration files to watch.
 		/// </summary>
-		private static ArrayList _filesToWatch = new ArrayList();
+		private static readonly ArrayList _filesToWatch = new ArrayList();
 
 		/// <summary>
 		/// The list of FileSystemWatcher.
 		/// </summary>
-		private static ArrayList _filesWatcher = new ArrayList();
+		private static readonly ArrayList _filesWatcher = new ArrayList();
 
 		/// <summary>
 		/// The default amount of time to wait after receiving notification

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/HashCodeProvider.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/HashCodeProvider.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/HashCodeProvider.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/HashCodeProvider.cs Sat Oct 11 09:07:44 2008
@@ -24,11 +24,7 @@
  ********************************************************************************/
 #endregion
 
-#region Imports
 using System;
-using System.Runtime.CompilerServices;
-
-#endregion
 
 namespace Apache.Ibatis.Common.Utilities
 {
@@ -39,7 +35,7 @@
 	/// </summary>
 	public sealed class HashCodeProvider
 	{
-		private static MethodInfo getHashCodeMethodInfo = null;
+		private static readonly MethodInfo getHashCodeMethodInfo = null;
 
 		static HashCodeProvider()
 		{

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/AbstractFactory.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/AbstractFactory.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/AbstractFactory.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/AbstractFactory.cs Sat Oct 11 09:07:44 2008
@@ -33,7 +33,7 @@
 	/// </summary>
     public class AbstractFactory : IFactory
     {
-        private Type _typeToCreate = null;
+        private readonly Type _typeToCreate = null;
         
         /// <summary>
         /// Initializes a new instance of the <see cref="AbstractFactory"/> class.

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/BoxingOpCodes.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/BoxingOpCodes.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/BoxingOpCodes.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/BoxingOpCodes.cs Sat Oct 11 09:07:44 2008
@@ -24,10 +24,7 @@
 #endregion
 
 using System;
-using System.Collections;
-using System.Reflection;
 using System.Reflection.Emit;
-using Apache.Ibatis.Common.Exceptions;
 using System.Collections.Generic;
 
 namespace Apache.Ibatis.Common.Utilities.Objects
@@ -38,7 +35,7 @@
     /// <remarks>From Spring.NET</remarks>
     public sealed class BoxingOpCodes
     {
-        private static IDictionary<Type,OpCode> boxingOpCodes;
+        private static readonly IDictionary<Type,OpCode> boxingOpCodes;
 
         /// <summary>
         /// Initializes the <see cref="BoxingOpCodes"/> class.

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/DelegateFactory.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/DelegateFactory.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/DelegateFactory.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/DelegateFactory.cs Sat Oct 11 09:07:44 2008
@@ -39,7 +39,7 @@
 
         private delegate object Create(object[] parameters);
 
-        private Create _create = null;
+        private readonly Create _create = null;
 
         #region IFactory members
 
@@ -69,7 +69,7 @@
         /// <param name="argumentTypes">The types argument.</param>
         public DelegateFactory(Type typeToCreate, Type[] argumentTypes)
         {
-            DynamicMethod dynamicMethod = new DynamicMethod("CreateImplementation", typeof(object), new Type[] { typeof(object[]) }, this.GetType().Module, false);
+            DynamicMethod dynamicMethod = new DynamicMethod("CreateImplementation", typeof(object), new Type[] { typeof(object[]) }, GetType().Module, false);
             ILGenerator generatorIL = dynamicMethod.GetILGenerator();
             
             // Emit the IL for Create method. 
@@ -93,7 +93,7 @@
         /// </summary>   
         /// <param name="il">IL generator.</param>   
         /// <param name="argumentTypes">Arguments type defined for a the constructor.</param>   
-        private void EmitArgsIL(ILGenerator il, Type[] argumentTypes)
+        private static void EmitArgsIL(ILGenerator il, Type[] argumentTypes)
         {
             // Add args. Since all args are objects, value types are unboxed. 
             // Refs to value types are to be converted to values themselves.   

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/DelegateObjectFactory.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/DelegateObjectFactory.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/DelegateObjectFactory.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/DelegateObjectFactory.cs Sat Oct 11 09:07:44 2008
@@ -88,7 +88,7 @@
 		/// <param name="typeToCreate">The type instance to build.</param>
 		/// <param name="arguments">The types of the constructor arguments</param>
 		/// <returns>The key for a cache entry.</returns>
-		private string GenerateKey(Type typeToCreate, object[] arguments)
+		private static string GenerateKey(Type typeToCreate, object[] arguments)
 		{
 			StringBuilder cacheKey = new StringBuilder();
 			cacheKey.Append(typeToCreate.ToString());

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/EmitObjectFactory.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/EmitObjectFactory.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/EmitObjectFactory.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/EmitObjectFactory.cs Sat Oct 11 09:07:44 2008
@@ -81,7 +81,7 @@
 		/// <param name="typeToCreate">The type instance to build.</param>
 		/// <param name="arguments">The types of the constructor arguments</param>
 		/// <returns>The key for a cache entry.</returns>
-		private string GenerateKey(Type typeToCreate, object[] arguments)
+		private static string GenerateKey(Type typeToCreate, object[] arguments)
 		{
 			StringBuilder cacheKey = new StringBuilder();
 			cacheKey.Append(typeToCreate.ToString());

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/FactoryBuilder.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/FactoryBuilder.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/FactoryBuilder.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/FactoryBuilder.cs Sat Oct 11 09:07:44 2008
@@ -40,7 +40,7 @@
         private const MethodAttributes CREATE_METHOD_ATTRIBUTES = MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Virtual | MethodAttributes.Final;
 		private static readonly ILog _logger = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType );
 
-        private ModuleBuilder _moduleBuilder = null;
+        private readonly ModuleBuilder _moduleBuilder = null;
        
         /// <summary>
 		/// constructor
@@ -48,7 +48,7 @@
 		public FactoryBuilder()
 		{
 			AssemblyName assemblyName = new AssemblyName();
-            assemblyName.Name = "iBATIS.EmitFactory" + HashCodeProvider.GetIdentityHashCode(this).ToString();
+            assemblyName.Name = "iBATIS.EmitFactory" + HashCodeProvider.GetIdentityHashCode(this);
 
 			// Create a new assembly with one module
 			AssemblyBuilder _assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
@@ -72,12 +72,9 @@
                 }
                 return new AbstractFactory(typeToCreate);
 			}
-			else
-			{
-				Type innerType = CreateFactoryType(typeToCreate, types);
-				ConstructorInfo ctor = innerType.GetConstructor(Type.EmptyTypes);
-				return (IFactory) ctor.Invoke(new object[] {});			
-			}
+		    Type innerType = CreateFactoryType(typeToCreate, types);
+		    ConstructorInfo ctor = innerType.GetConstructor(Type.EmptyTypes);
+		    return (IFactory) ctor.Invoke(new object[] {});
 		}
 
 
@@ -92,7 +89,7 @@
 			string typesName = string.Empty;
 			for(int i = 0; i < types.Length; i++)
 			{
-				typesName += types[i].Name.Replace("[]",string.Empty)+i.ToString();
+				typesName += types[i].Name.Replace("[]",string.Empty)+i;
 			}
 			TypeBuilder typeBuilder = _moduleBuilder.DefineType("EmitFactoryFor" + typeToCreate.FullName + typesName, TypeAttributes.Public);
 			typeBuilder.AddInterfaceImplementation(typeof (IFactory));
@@ -130,7 +127,7 @@
 		/// </summary>   
 		/// <param name="il">IL generator.</param>   
 		/// <param name="argumentTypes">Arguments type defined for a the constructor.</param>   
-		private void EmitArgsIL(ILGenerator il, Type[] argumentTypes)   
+		private static void EmitArgsIL(ILGenerator il, Type[] argumentTypes)   
 		{   
 			// Add args. Since all args are objects, value types are unboxed. 
 			// Refs to value types are to be converted to values themselves.   

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/FactoryLogAdapter.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/FactoryLogAdapter.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/FactoryLogAdapter.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/FactoryLogAdapter.cs Sat Oct 11 09:07:44 2008
@@ -36,9 +36,9 @@
 	/// </summary>
 	public class FactoryLogAdapter : IFactory
 	{
-		private IFactory _factory = null;
-		private string _typeName = string.Empty;
-		private string _parametersTypeName = string.Empty;
+		private readonly IFactory _factory = null;
+		private readonly string _typeName = string.Empty;
+		private readonly string _parametersTypeName = string.Empty;
 		
 		private static readonly ILog _logger = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType );
 
@@ -93,7 +93,7 @@
 		/// </summary>
 		/// <param name="arguments">The types of the constructor arguments</param>
 		/// <returns>The string.</returns>
-		private string GenerateParametersName(object[] arguments)
+		private static string GenerateParametersName(object[] arguments)
 		{
 			StringBuilder names = new StringBuilder();
 			if ((arguments != null) && (arguments.Length != 0)) 
@@ -111,7 +111,7 @@
 		/// </summary>
 		/// <param name="arguments">The arguments</param>
 		/// <returns>The string.</returns>
-		private string GenerateLogInfoForParameterValue(object[] arguments)
+		private static string GenerateLogInfoForParameterValue(object[] arguments)
 		{
 			StringBuilder values = new StringBuilder();
 			if ((arguments != null) && (arguments.Length != 0)) 

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/AccessorFactory.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/AccessorFactory.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/AccessorFactory.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/AccessorFactory.cs Sat Oct 11 09:07:44 2008
@@ -30,8 +30,8 @@
     /// </summary>
     public class AccessorFactory
     {
-        private ISetAccessorFactory _setAccessorFactory = null;
-        private IGetAccessorFactory _getAccessorFactory = null;
+        private readonly ISetAccessorFactory _setAccessorFactory = null;
+        private readonly IGetAccessorFactory _getAccessorFactory = null;
 
         /// <summary>
         /// The factory which build <see cref="ISetAccessor"/>

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegateGetFieldAccessor.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegateGetFieldAccessor.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegateGetFieldAccessor.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegateGetFieldAccessor.cs Sat Oct 11 09:07:44 2008
@@ -38,18 +38,18 @@
     {
         private delegate object GetValue(object instance);
 
-        private GetValue _get = null;
+        private readonly GetValue _get = null;
         /// <summary>
         /// The field name
         /// </summary>
-        private string _fieldName = string.Empty;
+        private readonly string _fieldName = string.Empty;
         /// <summary>
         /// The class parent type
         /// </summary>
-        private Type _fieldType = null;
+        private readonly Type _fieldType = null;
 
          /// <summary>
-        /// Initializes a new instance of the <see cref="T:DelegateFieldGetAccessor"/> class
+        /// Initializes a new instance of the <see cref="DelegateFieldGetAccessor"/> class
         /// for field get access via DynamicMethod.
         /// </summary>
         /// <param name="targetObjectType">Type of the target object.</param>
@@ -68,30 +68,27 @@
                     string.Format("Field \"{0}\" does not exist for type "
                     + "{1}.", fieldName, targetObjectType));
             }
-            else
-            {
-                _fieldType = fieldInfo.FieldType;
-                this.nullInternal = this.GetNullInternal(_fieldType);
+             _fieldType = fieldInfo.FieldType;
+             nullInternal = GetNullInternal(_fieldType);
 
-                DynamicMethod dynamicMethodGet = new DynamicMethod("GetImplementation", typeof(object), new Type[] { typeof(object) }, this.GetType().Module, false);
-                ILGenerator ilgen = dynamicMethodGet.GetILGenerator();
+             DynamicMethod dynamicMethodGet = new DynamicMethod("GetImplementation", typeof(object), new Type[] { typeof(object) }, GetType().Module, false);
+             ILGenerator ilgen = dynamicMethodGet.GetILGenerator();
 
-                // Emit the IL for get access. 
+             // Emit the IL for get access. 
 
-                // We need a reference to the current instance (stored in local argument index 0) 
-                // so Ldfld can load from the correct instance (this one).
-                ilgen.Emit(OpCodes.Ldarg_0);
-                ilgen.Emit(OpCodes.Ldfld, fieldInfo);
-                if (_fieldType.IsValueType)
-                {
-                    // Now, we execute the box opcode, which pops the value of field 'x',
-                    // returning a reference to the filed value boxed as an object.
-                    ilgen.Emit(OpCodes.Box, fieldInfo.FieldType);
-                }
-                ilgen.Emit(OpCodes.Ret);
-                _get = (GetValue)dynamicMethodGet.CreateDelegate(typeof(GetValue));              
-            }
-		}
+             // We need a reference to the current instance (stored in local argument index 0) 
+             // so Ldfld can load from the correct instance (this one).
+             ilgen.Emit(OpCodes.Ldarg_0);
+             ilgen.Emit(OpCodes.Ldfld, fieldInfo);
+             if (_fieldType.IsValueType)
+             {
+                 // Now, we execute the box opcode, which pops the value of field 'x',
+                 // returning a reference to the filed value boxed as an object.
+                 ilgen.Emit(OpCodes.Box, fieldInfo.FieldType);
+             }
+             ilgen.Emit(OpCodes.Ret);
+             _get = (GetValue)dynamicMethodGet.CreateDelegate(typeof(GetValue));
+        }
 
         #region IAccessor Members
 

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegatePropertyGetAccessor.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegatePropertyGetAccessor.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegatePropertyGetAccessor.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegatePropertyGetAccessor.cs Sat Oct 11 09:07:44 2008
@@ -38,12 +38,12 @@
     {
         private delegate object GetValue(object instance);
 
-        private GetValue _get = null;
+        private readonly GetValue _get = null;
          /// <summary>
         /// The property type
         /// </summary>
-        private Type _propertyType = null;
-        private bool _canRead = false;
+        private readonly Type _propertyType = null;
+        private readonly bool _canRead = false;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="DelegatePropertyGetAccessor"/> class
@@ -70,36 +70,33 @@
 					string.Format("Property \"{0}\" does not exist for type "
                     + "{1}.", propertyName, targetType));
 			}
-			else
-			{
-                _propertyType = propertyInfo.PropertyType;
-                _canRead = propertyInfo.CanRead;
+            _propertyType = propertyInfo.PropertyType;
+            _canRead = propertyInfo.CanRead;
+
+            nullInternal = GetNullInternal(_propertyType);
+
+            if (propertyInfo.CanRead)
+            {
+                DynamicMethod dynamicMethod = new DynamicMethod("GetImplementation", typeof(object), new Type[] { typeof(object) }, GetType().Module, true);
+                ILGenerator ilgen = dynamicMethod.GetILGenerator();
 
-                this.nullInternal = this.GetNullInternal(_propertyType);
+                // Emit the IL for get access. 
+                MethodInfo targetGetMethod = propertyInfo.GetGetMethod();
 
-    			if (propertyInfo.CanRead)
-				{
-					DynamicMethod dynamicMethod = new DynamicMethod("GetImplementation", typeof(object), new Type[] { typeof(object) }, this.GetType().Module, true);
-					ILGenerator ilgen = dynamicMethod.GetILGenerator();
-
-                    // Emit the IL for get access. 
-                    MethodInfo targetGetMethod = propertyInfo.GetGetMethod();
-
-                    ilgen.DeclareLocal(typeof(object));
-                    ilgen.Emit(OpCodes.Ldarg_0);	//Load the first argument,(target object)
-                    ilgen.Emit(OpCodes.Castclass, targetObjectType);	//Cast to the source type
-                    ilgen.EmitCall(OpCodes.Callvirt, targetGetMethod, null); //Get the property value
-                    if (targetGetMethod.ReturnType.IsValueType)
-                    {
-                        ilgen.Emit(OpCodes.Box, targetGetMethod.ReturnType); //Box if necessary
-                    }
-                    ilgen.Emit(OpCodes.Stloc_0); //Store it
-                    ilgen.Emit(OpCodes.Ldloc_0);
-                    ilgen.Emit(OpCodes.Ret);
+                ilgen.DeclareLocal(typeof(object));
+                ilgen.Emit(OpCodes.Ldarg_0);	//Load the first argument,(target object)
+                ilgen.Emit(OpCodes.Castclass, targetObjectType);	//Cast to the source type
+                ilgen.EmitCall(OpCodes.Callvirt, targetGetMethod, null); //Get the property value
+                if (targetGetMethod.ReturnType.IsValueType)
+                {
+                    ilgen.Emit(OpCodes.Box, targetGetMethod.ReturnType); //Box if necessary
+                }
+                ilgen.Emit(OpCodes.Stloc_0); //Store it
+                ilgen.Emit(OpCodes.Ldloc_0);
+                ilgen.Emit(OpCodes.Ret);
   
-					_get = (GetValue)dynamicMethod.CreateDelegate(typeof(GetValue));
-				}
-			}
+                _get = (GetValue)dynamicMethod.CreateDelegate(typeof(GetValue));
+            }
 		}
             
         #region IAccessor Members

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegatePropertySetAccessor.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegatePropertySetAccessor.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegatePropertySetAccessor.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegatePropertySetAccessor.cs Sat Oct 11 09:07:44 2008
@@ -38,13 +38,13 @@
     {
         private delegate void SetValue(object instance, object value);
 
-        private SetValue _set = null;
+        private readonly SetValue _set = null;
 
         /// <summary>
         /// The property type
         /// </summary>
-        private Type _propertyType = null;
-        private bool _canWrite = false;
+        private readonly Type _propertyType = null;
+        private readonly bool _canWrite = false;
 
                 /// <summary>
         /// Initializes a new instance of the <see cref="DelegatePropertySetAccessor"/> class
@@ -66,49 +66,46 @@
 					string.Format("Property \"{0}\" does not exist for type "
                     + "{1}.", propertyName, targetType));
 			}
-			else
-			{
-                _propertyType = propertyInfo.PropertyType;
-                _canWrite = propertyInfo.CanWrite;
+                    _propertyType = propertyInfo.PropertyType;
+                    _canWrite = propertyInfo.CanWrite;
 
-                this.nullInternal = this.GetNullInternal(_propertyType);
+                    nullInternal = GetNullInternal(_propertyType);
 
-				if (propertyInfo.CanWrite)
-				{
-					DynamicMethod dynamicMethod = new DynamicMethod("SetImplementation", null, new Type[] { typeof(object), typeof(object) }, this.GetType().Module, true);
-					ILGenerator ilgen = dynamicMethod.GetILGenerator();
+                    if (propertyInfo.CanWrite)
+                    {
+                        DynamicMethod dynamicMethod = new DynamicMethod("SetImplementation", null, new Type[] { typeof(object), typeof(object) }, GetType().Module, true);
+                        ILGenerator ilgen = dynamicMethod.GetILGenerator();
                     
-                    // Emit the IL for set access. 
-                    MethodInfo targetSetMethod = propertyInfo.GetSetMethod();
+                        // Emit the IL for set access. 
+                        MethodInfo targetSetMethod = propertyInfo.GetSetMethod();
 
-                    Type paramType = targetSetMethod.GetParameters()[0].ParameterType;
-                    ilgen.DeclareLocal(paramType);
-                    ilgen.Emit(OpCodes.Ldarg_0); //Load the first argument (target object)
-                    ilgen.Emit(OpCodes.Castclass, targetType); //Cast to the source type
-                    ilgen.Emit(OpCodes.Ldarg_1); //Load the second argument (value object)
-                    if (paramType.IsValueType)
-                    {
-                        ilgen.Emit(OpCodes.Unbox, paramType); //Unbox it 	
-                        if (typeToOpcode[paramType] != null)
+                        Type paramType = targetSetMethod.GetParameters()[0].ParameterType;
+                        ilgen.DeclareLocal(paramType);
+                        ilgen.Emit(OpCodes.Ldarg_0); //Load the first argument (target object)
+                        ilgen.Emit(OpCodes.Castclass, targetType); //Cast to the source type
+                        ilgen.Emit(OpCodes.Ldarg_1); //Load the second argument (value object)
+                        if (paramType.IsValueType)
                         {
-                            OpCode load = (OpCode)typeToOpcode[paramType];
-                            ilgen.Emit(load); //and load
+                            ilgen.Emit(OpCodes.Unbox, paramType); //Unbox it 	
+                            if (typeToOpcode[paramType] != null)
+                            {
+                                OpCode load = (OpCode)typeToOpcode[paramType];
+                                ilgen.Emit(load); //and load
+                            }
+                            else
+                            {
+                                ilgen.Emit(OpCodes.Ldobj, paramType);
+                            }
                         }
                         else
                         {
-                            ilgen.Emit(OpCodes.Ldobj, paramType);
+                            ilgen.Emit(OpCodes.Castclass, paramType); //Cast class
                         }
-                    }
-                    else
-                    {
-                        ilgen.Emit(OpCodes.Castclass, paramType); //Cast class
-                    }
-                    ilgen.EmitCall(OpCodes.Callvirt, targetSetMethod, null); //Set the property value
-                    ilgen.Emit(OpCodes.Ret);
+                        ilgen.EmitCall(OpCodes.Callvirt, targetSetMethod, null); //Set the property value
+                        ilgen.Emit(OpCodes.Ret);
 				
-					_set = (SetValue)dynamicMethod.CreateDelegate(typeof(SetValue));
-				}
-			}
+                        _set = (SetValue)dynamicMethod.CreateDelegate(typeof(SetValue));
+                    }
 		}
 
         #region IAccessor Members

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegateSetFieldAccessor.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegateSetFieldAccessor.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegateSetFieldAccessor.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/DelegateSetFieldAccessor.cs Sat Oct 11 09:07:44 2008
@@ -38,19 +38,19 @@
     {
         private delegate void SetValue(object instance, object value);
 
-        private SetValue _set = null;
+        private readonly SetValue _set = null;
 
         /// <summary>
         /// The field name
         /// </summary>
-        private string _fieldName = string.Empty;
+        private readonly string _fieldName = string.Empty;
         /// <summary>
         /// The class parent type
         /// </summary>
-        private Type _fieldType = null;
+        private readonly Type _fieldType = null;
 
                  /// <summary>
-        /// Initializes a new instance of the <see cref="T:DelegateFieldSetAccessor"/> class
+        /// Initializes a new instance of the <see cref="DelegateFieldSetAccessor"/> class
         /// for field get access via DynamicMethod.
         /// </summary>
         /// <param name="targetObjectType">Type of the target object.</param>
@@ -69,26 +69,23 @@
                     string.Format("Field \"{0}\" does not exist for type "
                     + "{1}.", fieldName, targetObjectType));
             }
-            else
-            {
-                _fieldType = fieldInfo.FieldType;
-                this.nullInternal = this.GetNullInternal(_fieldType);
+                     _fieldType = fieldInfo.FieldType;
+                     nullInternal = GetNullInternal(_fieldType);
 
-                // Emit the IL for set access. 
-                DynamicMethod dynamicMethodSet = new DynamicMethod("SetImplementation", null, new Type[] { typeof(object), typeof(object) }, this.GetType().Module, false);
-                ILGenerator ilgen = dynamicMethodSet.GetILGenerator();
-
-                ilgen = dynamicMethodSet.GetILGenerator();
-
-                ilgen.Emit(OpCodes.Ldarg_0);
-                ilgen.Emit(OpCodes.Ldarg_1);
-                UnboxIfNeeded(fieldInfo.FieldType, ilgen);
-                ilgen.Emit(OpCodes.Stfld, fieldInfo);
-                ilgen.Emit(OpCodes.Ret);
+                     // Emit the IL for set access. 
+                     DynamicMethod dynamicMethodSet = new DynamicMethod("SetImplementation", null, new Type[] { typeof(object), typeof(object) }, GetType().Module, false);
+                     ILGenerator ilgen = dynamicMethodSet.GetILGenerator();
+
+                     ilgen = dynamicMethodSet.GetILGenerator();
+
+                     ilgen.Emit(OpCodes.Ldarg_0);
+                     ilgen.Emit(OpCodes.Ldarg_1);
+                     UnboxIfNeeded(fieldInfo.FieldType, ilgen);
+                     ilgen.Emit(OpCodes.Stfld, fieldInfo);
+                     ilgen.Emit(OpCodes.Ret);
 
-                _set = (SetValue)dynamicMethodSet.CreateDelegate(typeof(SetValue));
-            }
-		}
+                     _set = (SetValue)dynamicMethodSet.CreateDelegate(typeof(SetValue));
+        }
 
         #region IAccessor Members
         

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitFieldGetAccessor.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitFieldGetAccessor.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitFieldGetAccessor.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitFieldGetAccessor.cs Sat Oct 11 09:07:44 2008
@@ -41,16 +41,16 @@
         /// <summary>
         /// The field name
         /// </summary>
-        private string _fieldName = string.Empty;        
+        private readonly string _fieldName = string.Empty;        
         /// <summary>
         /// The class parent type
         /// </summary>
-        private Type _fieldType = null;
+        private readonly Type _fieldType = null;
         /// <summary>
         /// The IL emitted IGet
         /// </summary>
         private IGet _emittedGet = null;
-        private Type _targetType = null;
+        private readonly Type _targetType = null;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="EmitFieldGetAccessor"/> class.
@@ -73,11 +73,8 @@
 					string.Format("Field \"{0}\" does not exist for type "
 					+ "{1}.", fieldName, targetObjectType));
 			}
-			else
-			{
-				_fieldType = fieldInfo.FieldType;
-                this.EmitIL(assemblyBuilder, moduleBuilder);
-			}
+            _fieldType = fieldInfo.FieldType;
+            EmitIL(assemblyBuilder, moduleBuilder);
 		}
 
         /// <summary>
@@ -94,12 +91,12 @@
             // Create a new instance
             _emittedGet = assemblyBuilder.CreateInstance("GetFor" + _targetType.FullName + _fieldName) as IGet;
 
-            this.nullInternal = this.GetNullInternal(_fieldType);
+            nullInternal = GetNullInternal(_fieldType);
 
             if (_emittedGet == null)
             {
                 throw new NotSupportedException(
-                    string.Format("Unable to create a get field accessor for '{0}' field on class  '{0}'.", _fieldName, _fieldType));
+                    string.Format("Unable to create a get field accessor for '{0}' field on class  '{1}'.", _fieldName, _fieldType));
             }
         }
 

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitFieldSetAccessor.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitFieldSetAccessor.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitFieldSetAccessor.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitFieldSetAccessor.cs Sat Oct 11 09:07:44 2008
@@ -41,16 +41,16 @@
         /// <summary>
         /// The field name
         /// </summary>
-        private string _fieldName = string.Empty;        
+        private readonly string _fieldName = string.Empty;        
         /// <summary>
         /// The class parent type
         /// </summary>
-        private Type _fieldType = null;
+        private readonly Type _fieldType = null;
         /// <summary>
         /// The IL emitted ISet
         /// </summary>
         private ISet _emittedSet = null;
-        private Type _targetType = null;
+        private readonly Type _targetType = null;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="EmitFieldGetAccessor"/> class.
@@ -73,11 +73,8 @@
 					string.Format("Field \"{0}\" does not exist for type "
 					+ "{1}.", fieldName, targetObjectType));
 			}
-			else
-			{
-				_fieldType = fieldInfo.FieldType;
-                this.EmitIL(assemblyBuilder, moduleBuilder);
-			}
+            _fieldType = fieldInfo.FieldType;
+            EmitIL(assemblyBuilder, moduleBuilder);
 		}
 
         /// <summary>
@@ -94,12 +91,12 @@
             // Create a new instance
             _emittedSet = assemblyBuilder.CreateInstance("SetFor" + _targetType.FullName + _fieldName) as ISet;
 
-            this.nullInternal = this.GetNullInternal(_fieldType);
+            nullInternal = GetNullInternal(_fieldType);
 
             if (_emittedSet == null)
             {
                 throw new NotSupportedException(
-                    string.Format("Unable to create a set field accessor for '{0}' field on class  '{0}'.", _fieldName, _fieldType));
+                    string.Format("Unable to create a set field accessor for '{0}' field on class  '{1}'.", _fieldName, _fieldType));
             }
         }
 

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitPropertyGetAccessor.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitPropertyGetAccessor.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitPropertyGetAccessor.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitPropertyGetAccessor.cs Sat Oct 11 09:07:44 2008
@@ -38,16 +38,16 @@
         /// <summary>
         /// The property name
         /// </summary>
-        private string _propertyName = string.Empty;
+        private readonly string _propertyName = string.Empty;
         /// <summary>
         /// The property type
         /// </summary>
-        private Type _propertyType = null;
+        private readonly Type _propertyType = null;
         /// <summary>
         /// The class parent type
         /// </summary>
-        private Type _targetType = null;
-        private bool _canRead = false;
+        private readonly Type _targetType = null;
+        private readonly bool _canRead = false;
         /// <summary>
         /// The IL emitted IGet
         /// </summary>
@@ -81,12 +81,9 @@
 					string.Format("Property \"{0}\" does not exist for type "
 					+ "{1}.", propertyName, _targetType));
 			}
-			else
-			{
-				this._propertyType = propertyInfo.PropertyType;
-                _canRead = propertyInfo.CanRead;
-                this.EmitIL(assemblyBuilder, moduleBuilder);
-			}
+            _propertyType = propertyInfo.PropertyType;
+            _canRead = propertyInfo.CanRead;
+            EmitIL(assemblyBuilder, moduleBuilder);
 		}
 
         /// <summary>
@@ -103,7 +100,7 @@
             // Create a new instance
             _emittedGet = assemblyBuilder.CreateInstance("GetFor" + _targetType.FullName + _propertyName) as IGet;
 
-            this.nullInternal = this.GetNullInternal(_propertyType);
+            nullInternal = GetNullInternal(_propertyType);
 
             if (_emittedGet == null)
             {
@@ -206,12 +203,9 @@
             {
                 return _emittedGet.Get(target);
             }
-            else
-            {
-                throw new NotSupportedException(
-                    string.Format("Property \"{0}\" on type "
-                    + "{1} doesn't have a get method.", _propertyName, _targetType));
-            }
+            throw new NotSupportedException(
+                string.Format("Property \"{0}\" on type "
+                              + "{1} doesn't have a get method.", _propertyName, _targetType));
         }
 
         #endregion

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitPropertySetAccessor.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitPropertySetAccessor.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitPropertySetAccessor.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/EmitPropertySetAccessor.cs Sat Oct 11 09:07:44 2008
@@ -38,17 +38,17 @@
         /// <summary>
         /// The property name
         /// </summary>
-        private string _propertyName = string.Empty;
+        private readonly string _propertyName = string.Empty;
         /// <summary>
         /// The property type
         /// </summary>
-        private Type _propertyType = null;
+        private readonly Type _propertyType = null;
         /// <summary>
         /// The class parent type
         /// </summary>
-        private Type _targetType = null;
+        private readonly Type _targetType = null;
 
-        private bool _canWrite = false;
+        private readonly bool _canWrite = false;
         /// <summary>
         /// The IL emitted ISet
         /// </summary>
@@ -82,12 +82,9 @@
 					string.Format("Property \"{0}\" does not exist for type "
 					+ "{1}.", propertyName, _targetType));
 			}
-			else
-			{
-				this._propertyType = propertyInfo.PropertyType;
-				_canWrite = propertyInfo.CanWrite;
-                this.EmitIL(assemblyBuilder, moduleBuilder);
-			}
+            _propertyType = propertyInfo.PropertyType;
+            _canWrite = propertyInfo.CanWrite;
+            EmitIL(assemblyBuilder, moduleBuilder);
 		}
 
 
@@ -105,12 +102,12 @@
             // Create a new instance
             _emittedSet = assemblyBuilder.CreateInstance("SetFor" + _targetType.FullName + _propertyName) as ISet;
 
-            this.nullInternal = this.GetNullInternal(_propertyType);
+            nullInternal = GetNullInternal(_propertyType);
 
             if (_emittedSet == null)
             {
                 throw new NotSupportedException(
-                    string.Format("Unable to create a get propert accessor for '{0}' property on class  '{1}'.", _propertyName, _propertyType.ToString()));
+                    string.Format("Unable to create a get propert accessor for '{0}' property on class  '{1}'.", _propertyName, _propertyType));
             }
         }
 

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/GetAccessorFactory.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/GetAccessorFactory.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/GetAccessorFactory.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/GetAccessorFactory.cs Sat Oct 11 09:07:44 2008
@@ -67,7 +67,7 @@
                 else
                 {
                     AssemblyName assemblyName = new AssemblyName();
-                    assemblyName.Name = "iBATIS.FastGetAccessor" + HashCodeProvider.GetIdentityHashCode(this).ToString();
+                    assemblyName.Name = "iBATIS.FastGetAccessor" + HashCodeProvider.GetIdentityHashCode(this);
 
                     // Create a new assembly with one module
                     _assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
@@ -90,7 +90,7 @@
         /// <param name="targetType">Target object type.</param>
         /// <param name="propertyName">Property name.</param>
         /// <returns>null if the generation fail</returns>
-        private IGetAccessor CreateDynamicPropertyGetAccessor(Type targetType, string propertyName)
+        private static IGetAccessor CreateDynamicPropertyGetAccessor(Type targetType, string propertyName)
         {
             ReflectionInfo reflectionCache = ReflectionInfo.GetInstance(targetType);
             PropertyInfo propertyInfo = (PropertyInfo)reflectionCache.GetGetter(propertyName);
@@ -104,17 +104,11 @@
                 {
                     return new DelegatePropertyGetAccessor(targetType, propertyName);
                 }
-                else
-                {
-                    return new ReflectionPropertyGetAccessor(targetType, propertyName);
-                }
-            }
-            else
-            {
-                throw new NotSupportedException(
-                    string.Format("Property \"{0}\" on type "
-                    + "{1} cannot be get.", propertyInfo.Name, targetType));
+                return new ReflectionPropertyGetAccessor(targetType, propertyName);
             }
+            throw new NotSupportedException(
+                string.Format("Property \"{0}\" on type "
+                              + "{1} cannot be get.", propertyInfo.Name, targetType));
         }
 
         /// <summary>
@@ -123,7 +117,7 @@
         /// <param name="targetType">Target object type.</param>
         /// <param name="fieldName">Property name.</param>
         /// <returns>null if the generation fail</returns>
-        private IGetAccessor CreateDynamicFieldGetAccessor(Type targetType, string fieldName)
+        private static IGetAccessor CreateDynamicFieldGetAccessor(Type targetType, string fieldName)
         {
             ReflectionInfo reflectionCache = ReflectionInfo.GetInstance(targetType);
             FieldInfo fieldInfo = (FieldInfo)reflectionCache.GetGetter(fieldName);
@@ -132,10 +126,7 @@
             {
                 return new DelegateFieldGetAccessor(targetType, fieldName);
             }
-            else
-            {
-                return new ReflectionFieldGetAccessor(targetType, fieldName);
-            }
+            return new ReflectionFieldGetAccessor(targetType, fieldName);
         }
 
         /// <summary>
@@ -159,17 +150,11 @@
                 {
                     return new EmitPropertyGetAccessor(targetType, propertyName, _assemblyBuilder, _moduleBuilder);
                 }
-                else
-                {
-                    return new ReflectionPropertyGetAccessor(targetType, propertyName);
-                }
-            }
-            else
-            {
-                throw new NotSupportedException(
-                    string.Format("Property \"{0}\" on type "
-                    + "{1} cannot be get.", propertyInfo.Name, targetType));
+                return new ReflectionPropertyGetAccessor(targetType, propertyName);
             }
+            throw new NotSupportedException(
+                string.Format("Property \"{0}\" on type "
+                              + "{1} cannot be get.", propertyInfo.Name, targetType));
         }
 
         /// <summary>
@@ -187,10 +172,7 @@
             {
                 return new EmitFieldGetAccessor(targetType, fieldName, _assemblyBuilder, _moduleBuilder);
             }
-            else
-            {
-                return new ReflectionFieldGetAccessor(targetType, fieldName);
-            }
+            return new ReflectionFieldGetAccessor(targetType, fieldName);
         }
 
         /// <summary>
@@ -199,7 +181,7 @@
         /// <param name="targetType">Target object type.</param>
         /// <param name="propertyName">Property name.</param>
         /// <returns>null if the generation fail</returns>
-        private IGetAccessor CreateReflectionPropertyGetAccessor(Type targetType, string propertyName)
+        private static IGetAccessor CreateReflectionPropertyGetAccessor(Type targetType, string propertyName)
         {
             return new ReflectionPropertyGetAccessor(targetType, propertyName);
         }
@@ -210,7 +192,7 @@
         /// <param name="targetType">Target object type.</param>
         /// <param name="fieldName">field name.</param>
         /// <returns>null if the generation fail</returns>
-        private IGetAccessor CreateReflectionFieldGetAccessor(Type targetType, string fieldName)
+        private static IGetAccessor CreateReflectionFieldGetAccessor(Type targetType, string fieldName)
         {
             return new ReflectionFieldGetAccessor(targetType, fieldName);
         }
@@ -232,44 +214,41 @@
             {
                 return (IGetAccessor)_cachedIGetAccessor[key];
             }
-            else
+            IGetAccessor getAccessor = null;
+            lock (syncLock)
             {
-                IGetAccessor getAccessor = null;
-                lock (syncLock)
+                if (!_cachedIGetAccessor.Contains(key))
                 {
-                    if (!_cachedIGetAccessor.Contains(key))
-                    {
-                        // Property
-                        ReflectionInfo reflectionCache = ReflectionInfo.GetInstance(targetType);
-                        MemberInfo memberInfo = reflectionCache.GetGetter(name);
+                    // Property
+                    ReflectionInfo reflectionCache = ReflectionInfo.GetInstance(targetType);
+                    MemberInfo memberInfo = reflectionCache.GetGetter(name);
 
-                        if (memberInfo != null)
+                    if (memberInfo != null)
+                    {
+                        if (memberInfo is PropertyInfo)
                         {
-                            if (memberInfo is PropertyInfo)
-                            {
-                                getAccessor = _createPropertyGetAccessor(targetType, name);
-                                _cachedIGetAccessor[key] = getAccessor;
-                            }
-                            else
-                            {
-                                getAccessor = _createFieldGetAccessor(targetType, name);
-                                _cachedIGetAccessor[key] = getAccessor;
-                            }
+                            getAccessor = _createPropertyGetAccessor(targetType, name);
+                            _cachedIGetAccessor[key] = getAccessor;
                         }
                         else
                         {
-                            throw new ProbeException(
-                                       string.Format("No property or field named \"{0}\" exists for type "
-                                       + "{1}.", name, targetType));
+                            getAccessor = _createFieldGetAccessor(targetType, name);
+                            _cachedIGetAccessor[key] = getAccessor;
                         }
                     }
                     else
                     {
-                        getAccessor = (IGetAccessor)_cachedIGetAccessor[key];
+                        throw new ProbeException(
+                            string.Format("No property or field named \"{0}\" exists for type "
+                                          + "{1}.", name, targetType));
                     }
                 }
-                return getAccessor;
+                else
+                {
+                    getAccessor = (IGetAccessor)_cachedIGetAccessor[key];
+                }
             }
+            return getAccessor;
         }
 
         #endregion

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionFieldGetAccessor.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionFieldGetAccessor.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionFieldGetAccessor.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionFieldGetAccessor.cs Sat Oct 11 09:07:44 2008
@@ -34,7 +34,7 @@
     /// </summary>
     public sealed class ReflectionFieldGetAccessor : IGetAccessor
     {
-        private FieldInfo _fieldInfo = null;
+        private readonly FieldInfo _fieldInfo = null;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="ReflectionFieldGetAccessor"/> class.

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionFieldSetAccessor.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionFieldSetAccessor.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionFieldSetAccessor.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionFieldSetAccessor.cs Sat Oct 11 09:07:44 2008
@@ -34,7 +34,7 @@
     /// </summary>
     public sealed class ReflectionFieldSetAccessor : ISetAccessor
     {
-                private FieldInfo _fieldInfo = null;
+        private readonly FieldInfo _fieldInfo = null;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="ReflectionFieldSetAccessor"/> class.

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionPropertyGetAccessor.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionPropertyGetAccessor.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionPropertyGetAccessor.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionPropertyGetAccessor.cs Sat Oct 11 09:07:44 2008
@@ -34,9 +34,9 @@
     /// </summary>
     public sealed class ReflectionPropertyGetAccessor : IGetAccessor
     {
-        private PropertyInfo _propertyInfo = null;
-		private string _propertyName = string.Empty;
-		private Type _targetType = null;
+        private readonly PropertyInfo _propertyInfo = null;
+		private readonly string _propertyName = string.Empty;
+		private readonly Type _targetType = null;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="ReflectionPropertyGetAccessor"/> class.
@@ -87,12 +87,9 @@
             {
                 return _propertyInfo.GetValue(target, null);
             }
-            else
-            {
-                throw new NotSupportedException(
-                    string.Format("Property \"{0}\" on type "
-                    + "{1} doesn't have a get method.", _propertyName, _targetType));
-            }
+            throw new NotSupportedException(
+                string.Format("Property \"{0}\" on type "
+                              + "{1} doesn't have a get method.", _propertyName, _targetType));
         }
 
         #endregion

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionPropertySetAccessor.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionPropertySetAccessor.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionPropertySetAccessor.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/ReflectionPropertySetAccessor.cs Sat Oct 11 09:07:44 2008
@@ -34,9 +34,9 @@
     /// </summary>
     public sealed class ReflectionPropertySetAccessor : ISetAccessor
     {
-        private PropertyInfo _propertyInfo = null;
-		private string _propertyName = string.Empty;
-		private Type _targetType = null;
+        private readonly PropertyInfo _propertyInfo = null;
+		private readonly string _propertyName = string.Empty;
+		private readonly Type _targetType = null;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="ReflectionPropertySetAccessor"/> class.

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/SetAccessorFactory.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/SetAccessorFactory.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/SetAccessorFactory.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/SetAccessorFactory.cs Sat Oct 11 09:07:44 2008
@@ -67,7 +67,7 @@
                 else
                 {
                     AssemblyName assemblyName = new AssemblyName();
-                    assemblyName.Name = "iBATIS.FastSetAccessor" + HashCodeProvider.GetIdentityHashCode(this).ToString();
+                    assemblyName.Name = "iBATIS.FastSetAccessor" + HashCodeProvider.GetIdentityHashCode(this);
 
                     // Create a new assembly with one module
                     _assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
@@ -90,7 +90,7 @@
         /// <param name="targetType">Target object type.</param>
         /// <param name="propertyName">Property name.</param>
         /// <returns>null if the generation fail</returns>
-        private ISetAccessor CreateDynamicPropertySetAccessor(Type targetType, string propertyName)
+        private static ISetAccessor CreateDynamicPropertySetAccessor(Type targetType, string propertyName)
         {
             ReflectionInfo reflectionCache = ReflectionInfo.GetInstance(targetType);
             PropertyInfo propertyInfo = (PropertyInfo)reflectionCache.GetSetter(propertyName);
@@ -104,17 +104,11 @@
                 {
                     return new DelegatePropertySetAccessor(targetType, propertyName);
                 }
-                else
-                {
-                    return new ReflectionPropertySetAccessor(targetType, propertyName);
-                }
-            }
-            else
-            {
-                throw new NotSupportedException(
-					string.Format("Property \"{0}\" on type "
-                    + "{1} cannot be set.", propertyInfo.Name, targetType));
+                return new ReflectionPropertySetAccessor(targetType, propertyName);
             }
+            throw new NotSupportedException(
+                string.Format("Property \"{0}\" on type "
+                              + "{1} cannot be set.", propertyInfo.Name, targetType));
         }
 
         /// <summary>
@@ -123,7 +117,7 @@
         /// <param name="targetType">Target object type.</param>
         /// <param name="fieldName">field name.</param>
         /// <returns>null if the generation fail</returns>
-        private ISetAccessor CreateDynamicFieldSetAccessor(Type targetType, string fieldName)
+        private static ISetAccessor CreateDynamicFieldSetAccessor(Type targetType, string fieldName)
         {
             ReflectionInfo reflectionCache = ReflectionInfo.GetInstance(targetType);
             FieldInfo fieldInfo = (FieldInfo)reflectionCache.GetSetter(fieldName);
@@ -132,10 +126,7 @@
             {
                 return new DelegateFieldSetAccessor(targetType, fieldName);
             }
-            else
-            {
-                return new ReflectionFieldSetAccessor(targetType, fieldName);
-            }
+            return new ReflectionFieldSetAccessor(targetType, fieldName);
         }
 
 
@@ -160,17 +151,11 @@
                 {
                     return new EmitPropertySetAccessor(targetType, propertyName, _assemblyBuilder, _moduleBuilder);
                 }
-                else
-                {
-                    return new ReflectionPropertySetAccessor(targetType, propertyName);
-                }
-            }
-            else
-            {
-                throw new NotSupportedException(
-                    string.Format("Property \"{0}\" on type "
-                    + "{1} cannot be set.", propertyInfo.Name, targetType));
+                return new ReflectionPropertySetAccessor(targetType, propertyName);
             }
+            throw new NotSupportedException(
+                string.Format("Property \"{0}\" on type "
+                              + "{1} cannot be set.", propertyInfo.Name, targetType));
         }
 
         /// <summary>
@@ -188,10 +173,7 @@
             {
                 return new EmitFieldSetAccessor(targetType, fieldName, _assemblyBuilder, _moduleBuilder);
             }
-            else
-            {
-                return new ReflectionFieldSetAccessor(targetType, fieldName);
-            }
+            return new ReflectionFieldSetAccessor(targetType, fieldName);
         }
 
         /// <summary>
@@ -200,7 +182,7 @@
         /// <param name="targetType">Target object type.</param>
         /// <param name="propertyName">Property name.</param>
         /// <returns>null if the generation fail</returns>
-        private ISetAccessor CreateReflectionPropertySetAccessor(Type targetType, string propertyName)
+        private static ISetAccessor CreateReflectionPropertySetAccessor(Type targetType, string propertyName)
         {
             return new ReflectionPropertySetAccessor(targetType, propertyName);
         }
@@ -211,7 +193,7 @@
         /// <param name="targetType">Target object type.</param>
         /// <param name="fieldName">field name.</param>
         /// <returns>null if the generation fail</returns>
-        private ISetAccessor CreateReflectionFieldSetAccessor(Type targetType, string fieldName)
+        private static ISetAccessor CreateReflectionFieldSetAccessor(Type targetType, string fieldName)
         {
             return new ReflectionFieldSetAccessor(targetType, fieldName);
         }
@@ -233,44 +215,41 @@
             {
                 return (ISetAccessor)_cachedISetAccessor[key];
             }
-            else
+            ISetAccessor setAccessor = null;
+            lock (syncLock)
             {
-                ISetAccessor setAccessor = null;
-                lock (syncLock)
+                if (!_cachedISetAccessor.Contains(key))
                 {
-                    if (!_cachedISetAccessor.Contains(key))
-                    {
-                        // Property
-                        ReflectionInfo reflectionCache = ReflectionInfo.GetInstance(targetType);
-                        MemberInfo memberInfo = reflectionCache.GetSetter(name);
+                    // Property
+                    ReflectionInfo reflectionCache = ReflectionInfo.GetInstance(targetType);
+                    MemberInfo memberInfo = reflectionCache.GetSetter(name);
 
-                        if (memberInfo != null)
+                    if (memberInfo != null)
+                    {
+                        if (memberInfo is PropertyInfo)
                         {
-                            if (memberInfo is PropertyInfo)
-                            {
-                                setAccessor = _createPropertySetAccessor(targetType, name);
-                                _cachedISetAccessor[key] = setAccessor;
-                            }
-                            else
-                            {
-                                setAccessor = _createFieldSetAccessor(targetType, name);
-                                _cachedISetAccessor[key] = setAccessor;
-                            }
+                            setAccessor = _createPropertySetAccessor(targetType, name);
+                            _cachedISetAccessor[key] = setAccessor;
                         }
                         else
                         {
-                            throw new ProbeException(
-                                string.Format("No property or field named \"{0}\" exists for type "
-                                + "{1}.", name, targetType));
-                        }                   
+                            setAccessor = _createFieldSetAccessor(targetType, name);
+                            _cachedISetAccessor[key] = setAccessor;
+                        }
                     }
                     else
                     {
-                        setAccessor = (ISetAccessor)_cachedISetAccessor[key];
-                    }
+                        throw new ProbeException(
+                            string.Format("No property or field named \"{0}\" exists for type "
+                                          + "{1}.", name, targetType));
+                    }                   
+                }
+                else
+                {
+                    setAccessor = (ISetAccessor)_cachedISetAccessor[key];
                 }
-                return setAccessor;
             }
+            return setAccessor;
         }
 
         #endregion

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ObjectFactory.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ObjectFactory.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ObjectFactory.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ObjectFactory.cs Sat Oct 11 09:07:44 2008
@@ -34,7 +34,7 @@
 	/// </summary>
 	public class ObjectFactory : IObjectFactory
 	{
-		private IObjectFactory _objectFactory = null;
+		private readonly IObjectFactory _objectFactory = null;
         private static readonly ILog _logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
 
 		/// <summary>
@@ -71,16 +71,13 @@
 		/// <returns>Returns a new instance factory</returns>
 		public IFactory CreateFactory(Type typeToCreate, Type[] types)
 		{
-            if (_logger.IsDebugEnabled)
+		    if (_logger.IsDebugEnabled)
             {
                 return new FactoryLogAdapter(typeToCreate, types, _objectFactory.CreateFactory(typeToCreate, types));
             }
-		    else
-            {
-                return _objectFactory.CreateFactory(typeToCreate, types);
-            }
+		    return _objectFactory.CreateFactory(typeToCreate, types);
 		}
 
-		#endregion
+	    #endregion
 	}
 }

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ObjectProbe.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ObjectProbe.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ObjectProbe.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ObjectProbe.cs Sat Oct 11 09:07:44 2008
@@ -38,7 +38,7 @@
 	/// </summary>
 	public sealed class ObjectProbe
 	{
-		private static ArrayList _simpleTypeMap = new ArrayList();
+		private static readonly ArrayList _simpleTypeMap = new ArrayList();
 
 		static ObjectProbe() 
 		{
@@ -296,7 +296,7 @@
 				int length = indexedName.IndexOf("]");
 				string name = indexedName.Substring(0, startIndex);
 				string index = indexedName.Substring( startIndex+1, length-(startIndex+1));
-				int i = System.Convert.ToInt32(index);
+				int i = Convert.ToInt32(index);
 				
 				if (name.Length > 0)
 				{
@@ -344,7 +344,7 @@
 				int length = indexedName.IndexOf("]");
 				string name = indexedName.Substring(0, startIndex);
 				string index = indexedName.Substring( startIndex+1, length-(startIndex+1));
-				int i = System.Convert.ToInt32(index);
+				int i = Convert.ToInt32(index);
 				
 				object list = null;
 				if (name.Length > 0)
@@ -385,17 +385,16 @@
         /// <returns>An Object representing the return value of the invoked property.</returns>
 		public static object GetMemberValue(object obj, string memberName,
             AccessorFactory accessorFactory)
-		{
-			if (memberName.IndexOf('.') > -1) 
+        {
+            if (memberName.IndexOf('.') > -1) 
 			{
 				StringTokenizer parser = new StringTokenizer(memberName, ".");
 				IEnumerator enumerator = parser.GetEnumerator();
 				object value = obj;
-				string token = null;
 
-				while (enumerator.MoveNext()) 
+			    while (enumerator.MoveNext()) 
 				{
-					token = (string)enumerator.Current;
+					string token = (string)enumerator.Current;
                     value = GetMember(value, token, accessorFactory);
 
 					if (value == null) 
@@ -404,15 +403,12 @@
 					}
 				}
 				return value;
-			} 
-			else 
-			{
-                return GetMember(obj, memberName, accessorFactory);
 			}
-		}
-        
+            return GetMember(obj, memberName, accessorFactory);
+        }
 
-        /// <summary>
+
+	    /// <summary>
         /// Gets the member's value on the specified object.
         /// </summary>
         /// <param name="obj">The obj.</param>
@@ -655,32 +651,29 @@
 		/// </summary>
 		/// <param name="type"></param>
 		/// <returns></returns>
-		public static bool IsSimpleType(Type type) 
+		public static bool IsSimpleType(Type type)
 		{
-			if (_simpleTypeMap.Contains(type)) 
+		    if (_simpleTypeMap.Contains(type)) 
 			{
 				return true;
-			} 
-			else if (typeof(ICollection).IsAssignableFrom(type))
-			{
-				return true;
-			} 
-			else if (typeof(IDictionary).IsAssignableFrom(type)) 
-			{
-				return true;
-			} 
-			else if (typeof(IList).IsAssignableFrom(type)) 
-			{
-				return true;
-			} 
-			else if (typeof(IEnumerable).IsAssignableFrom(type)) 
-			{
-				return true;
-			} 
-			else
-			{
-				return false;
 			}
+		    if (typeof(ICollection).IsAssignableFrom(type))
+		    {
+		        return true;
+		    }
+		    if (typeof(IDictionary).IsAssignableFrom(type)) 
+		    {
+		        return true;
+		    }
+		    if (typeof(IList).IsAssignableFrom(type)) 
+		    {
+		        return true;
+		    }
+		    if (typeof(IEnumerable).IsAssignableFrom(type)) 
+		    {
+		        return true;
+		    }
+		    return false;
 		}
 
 

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ReflectionInfo.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ReflectionInfo.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ReflectionInfo.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ReflectionInfo.cs Sat Oct 11 09:07:44 2008
@@ -306,31 +306,28 @@
         /// <returns>
         /// 	<c>true</c> if [is known type] [the specified type]; otherwise, <c>false</c>.
         /// </returns>
-		public static bool IsKnownType(Type type) 
-		{
-			if (_simleTypeMap.Contains(type)) 
-			{
-				return true;
-			} 
-			else if (typeof(IList).IsAssignableFrom(type)) 
-			{
-				return true;
-			} 
-			else if (typeof(IDictionary).IsAssignableFrom(type)) 
+		public static bool IsKnownType(Type type)
+        {
+            if (_simleTypeMap.Contains(type)) 
 			{
 				return true;
-			} 
-			else if (typeof(IEnumerator).IsAssignableFrom(type)) 
-			{
-				return true;
-			} 
-			else 
-			{
-				return false;
 			}
-		}
+            if (typeof(IList).IsAssignableFrom(type)) 
+            {
+                return true;
+            }
+            if (typeof(IDictionary).IsAssignableFrom(type)) 
+            {
+                return true;
+            }
+            if (typeof(IEnumerator).IsAssignableFrom(type)) 
+            {
+                return true;
+            }
+            return false;
+        }
 
-		/// <summary>
+	    /// <summary>
 		/// Gets an instance of ReflectionInfo for the specified type.
 		/// </summary>summary>
 		/// <param name="type">The type for which to lookup the method cache.</param>

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/ReadOnlyDictionary.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/ReadOnlyDictionary.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/ReadOnlyDictionary.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/ReadOnlyDictionary.cs Sat Oct 11 09:07:44 2008
@@ -25,7 +25,6 @@
 #endregion
 
 using System.Collections;
-using System.Collections.ObjectModel;
 using System.Runtime.Serialization;
 using System.Collections.Generic;
 using System;
@@ -37,17 +36,17 @@
     /// mirrors ReadOnlyCollection, and follows the apparent pattern that write operations
     /// do not throw an exception, but simply make no change to the underlying collection.
     /// </summary>
-   public class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IDictionary, ICollection, IEnumerable, ISerializable, IDeserializationCallback
+   public class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue>, IDictionary, ISerializable, IDeserializationCallback
    { 
        /// <summary>
         /// 
         /// </summary>
-        private IDictionary<TKey, TValue> dict;
+        private readonly IDictionary<TKey, TValue> dict;
 
         /// <summary>
         /// 
         /// </summary>
-        private IDictionary idict;
+        private readonly IDictionary idict;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="ReadOnlyDictionary&lt;TKey, TValue&gt;"/> class.

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/StringTokenizer.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/StringTokenizer.cs?rev=703678&r1=703677&r2=703678&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/StringTokenizer.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/StringTokenizer.cs Sat Oct 11 09:07:44 2008
@@ -35,7 +35,7 @@
 	/// </summary>
 	public sealed class StringTokenizer : IEnumerable 
 	{
-		private static readonly string defaultDelim=" \t\n\r\f";
+		private const string DEFAULT_DELIM = " \t\n\r\f";
         private readonly string  origin = string.Empty;
         private readonly string delimiters = string.Empty;
         private readonly bool returnDelimiters = false;
@@ -48,7 +48,7 @@
 		public StringTokenizer(string str) 
 		{
 			origin = str;
-			delimiters = defaultDelim;
+			delimiters = DEFAULT_DELIM;
 			returnDelimiters = false;
 		}
 
@@ -176,14 +176,11 @@
 
 			private string GetNext() 
 			{
-				char c;
-				bool isDelim;
-			
-				if( cursor >= stokenizer.origin.Length )
+			    if( cursor >= stokenizer.origin.Length )
 					return null;
 
-				c = stokenizer.origin[cursor];
-				isDelim = (stokenizer.delimiters.IndexOf(c) != -1);
+				char c = stokenizer.origin[cursor];
+				bool isDelim = (stokenizer.delimiters.IndexOf(c) != -1);
 			
 				if ( isDelim ) 
 				{



Mime
View raw message