From: Kevin W. <kev...@us...> - 2004-12-31 21:55:48
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Property In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4531 Modified Files: BasicGetter.cs BasicPropertyAccessor.cs BasicSetter.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: BasicPropertyAccessor.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Property/BasicPropertyAccessor.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BasicPropertyAccessor.cs 23 Aug 2004 13:11:08 -0000 1.2 --- BasicPropertyAccessor.cs 31 Dec 2004 21:55:38 -0000 1.3 *************** *** 1,4 **** - using System; using System.Reflection; namespace NHibernate.Property --- 1,4 ---- using System.Reflection; + using log4net; namespace NHibernate.Property *************** *** 10,28 **** public class BasicPropertyAccessor : IPropertyAccessor { ! private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(BasicPropertyAccessor)); ! #region IPropertyAccessor Members ! public ISetter GetSetter(System.Type type, string propertyName) { ! BasicSetter result = GetSetterOrNull(type, propertyName); ! if (result==null) throw new PropertyNotFoundException( "Could not find a setter for property " + propertyName + " in class " + type.FullName ); return result; } ! public IGetter GetGetter(System.Type theClass, string propertyName) { ! BasicGetter result = GetGetterOrNull(theClass, propertyName); ! if (result == null) throw new PropertyNotFoundException( "Could not find a setter for property " + propertyName + " in class " + theClass.FullName ); return result; } --- 10,46 ---- public class BasicPropertyAccessor : IPropertyAccessor { ! private static readonly ILog log = LogManager.GetLogger( typeof( BasicPropertyAccessor ) ); ! #region IPropertyAccessor Members ! /// <summary> ! /// ! /// </summary> ! /// <param name="type"></param> ! /// <param name="propertyName"></param> ! /// <returns></returns> ! public ISetter GetSetter( System.Type type, string propertyName ) { ! BasicSetter result = GetSetterOrNull( type, propertyName ); ! if( result == null ) ! { ! throw new PropertyNotFoundException( "Could not find a setter for property " + propertyName + " in class " + type.FullName ); ! } return result; } ! /// <summary> ! /// ! /// </summary> ! /// <param name="theClass"></param> ! /// <param name="propertyName"></param> ! /// <returns></returns> ! public IGetter GetGetter( System.Type theClass, string propertyName ) { ! BasicGetter result = GetGetterOrNull( theClass, propertyName ); ! if( result == null ) ! { ! throw new PropertyNotFoundException( "Could not find a setter for property " + propertyName + " in class " + theClass.FullName ); ! } return result; } *************** *** 30,53 **** #endregion ! internal static BasicSetter GetSetterOrNull(System.Type type, string propertyName) { ! if (type == typeof(object) || type == null) return null; //PropertyInfo property = type.GetProperty(propertyName); ! PropertyInfo property = type.GetProperty(propertyName, BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.DeclaredOnly); ! if (property != null) { ! return new BasicSetter(type, property, propertyName); ! } ! else { BasicSetter setter = GetSetterOrNull( type.BaseType, propertyName ); ! if (setter == null) { ! System.Type[] interfaces = type.GetInterfaces(); ! for ( int i=0; setter==null && i<interfaces.Length; i++) { ! setter = GetSetterOrNull(interfaces[i], propertyName); } } --- 48,80 ---- #endregion ! /// <summary> ! /// ! /// </summary> ! /// <param name="type"></param> ! /// <param name="propertyName"></param> ! /// <returns></returns> ! internal static BasicSetter GetSetterOrNull( System.Type type, string propertyName ) { ! if( type == typeof( object ) || type == null ) ! { ! return null; ! } //PropertyInfo property = type.GetProperty(propertyName); ! PropertyInfo property = type.GetProperty( propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly ); ! if( property != null ) { ! return new BasicSetter( type, property, propertyName ); ! } ! else { BasicSetter setter = GetSetterOrNull( type.BaseType, propertyName ); ! if( setter == null ) { ! System.Type[ ] interfaces = type.GetInterfaces(); ! for( int i = 0; setter == null && i < interfaces.Length; i++ ) { ! setter = GetSetterOrNull( interfaces[ i ], propertyName ); } } *************** *** 55,79 **** } } ! ! internal static BasicGetter GetGetterOrNull(System.Type type, string propertyName) { ! if (type==typeof(object) || type==null) return null; //PropertyInfo property = type.GetProperty(propertyName); ! PropertyInfo property = type.GetProperty(propertyName, BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.DeclaredOnly); ! if (property != null) { ! return new BasicGetter(type, property, propertyName); ! } ! else { BasicGetter getter = GetGetterOrNull( type.BaseType, propertyName ); ! if (getter == null) { ! System.Type[] interfaces = type.GetInterfaces(); ! for (int i=0; getter==null && i<interfaces.Length; i++) { ! getter = GetGetterOrNull( interfaces[i], propertyName ); } } --- 82,115 ---- } } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="type"></param> ! /// <param name="propertyName"></param> ! /// <returns></returns> ! internal static BasicGetter GetGetterOrNull( System.Type type, string propertyName ) { ! if( type == typeof( object ) || type == null ) ! { ! return null; ! } //PropertyInfo property = type.GetProperty(propertyName); ! PropertyInfo property = type.GetProperty( propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly ); ! if( property != null ) { ! return new BasicGetter( type, property, propertyName ); ! } ! else { BasicGetter getter = GetGetterOrNull( type.BaseType, propertyName ); ! if( getter == null ) { ! System.Type[ ] interfaces = type.GetInterfaces(); ! for( int i = 0; getter == null && i < interfaces.Length; i++ ) { ! getter = GetGetterOrNull( interfaces[ i ], propertyName ); } } *************** *** 82,85 **** } ! } ! } --- 118,121 ---- } ! } ! } \ No newline at end of file Index: BasicGetter.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Property/BasicGetter.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BasicGetter.cs 22 Aug 2004 06:18:54 -0000 1.1 --- BasicGetter.cs 31 Dec 2004 21:55:37 -0000 1.2 *************** *** 4,11 **** namespace NHibernate.Property { ! ! /// <summary> ! /// ! /// </summary> public sealed class BasicGetter : IGetter { --- 4,8 ---- namespace NHibernate.Property { ! /// <summary></summary> public sealed class BasicGetter : IGetter { *************** *** 14,18 **** private string propertyName; ! public BasicGetter(System.Type clazz, PropertyInfo property, string propertyName) { this.clazz = clazz; --- 11,21 ---- private string propertyName; ! /// <summary> ! /// ! /// </summary> ! /// <param name="clazz"></param> ! /// <param name="property"></param> ! /// <param name="propertyName"></param> ! public BasicGetter( System.Type clazz, PropertyInfo property, string propertyName ) { this.clazz = clazz; *************** *** 23,38 **** #region IGetter Members ! public object Get(object target) { ! try { ! return property.GetValue(target, new object[0]); ! } ! catch (Exception e) { ! throw new PropertyAccessException(e, "Exception occurred", false, clazz, propertyName); } } public System.Type ReturnType { --- 26,47 ---- #region IGetter Members ! /// <summary> ! /// ! /// </summary> ! /// <param name="target"></param> ! /// <returns></returns> ! public object Get( object target ) { ! try { ! return property.GetValue( target, new object[0] ); ! } ! catch( Exception e ) { ! throw new PropertyAccessException( e, "Exception occurred", false, clazz, propertyName ); } } + /// <summary></summary> public System.Type ReturnType { *************** *** 40,43 **** --- 49,53 ---- } + /// <summary></summary> public string PropertyName { *************** *** 45,54 **** } public PropertyInfo Property { ! get{ return property; } } #endregion } ! } --- 55,65 ---- } + /// <summary></summary> public PropertyInfo Property { ! get { return property; } } #endregion } ! } \ No newline at end of file Index: BasicSetter.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Property/BasicSetter.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BasicSetter.cs 22 Aug 2004 06:18:54 -0000 1.1 --- BasicSetter.cs 31 Dec 2004 21:55:38 -0000 1.2 *************** *** 4,10 **** namespace NHibernate.Property { ! /// <summary> ! /// ! /// </summary> public sealed class BasicSetter : ISetter { --- 4,8 ---- namespace NHibernate.Property { ! /// <summary></summary> public sealed class BasicSetter : ISetter { *************** *** 13,17 **** private string propertyName; ! public BasicSetter(System.Type clazz, PropertyInfo property, string propertyName) { this.clazz = clazz; --- 11,21 ---- private string propertyName; ! /// <summary> ! /// ! /// </summary> ! /// <param name="clazz"></param> ! /// <param name="property"></param> ! /// <param name="propertyName"></param> ! public BasicSetter( System.Type clazz, PropertyInfo property, string propertyName ) { this.clazz = clazz; *************** *** 22,37 **** #region ISetter Members ! public void Set(object target, object value) { ! try { ! property.SetValue(target, value, new object[0]); ! } ! catch (Exception e) { ! throw new PropertyAccessException(e, "Exception occurred", true, clazz, propertyName); } } public string PropertyName { --- 26,47 ---- #region ISetter Members ! /// <summary> ! /// ! /// </summary> ! /// <param name="target"></param> ! /// <param name="value"></param> ! public void Set( object target, object value ) { ! try { ! property.SetValue( target, value, new object[0] ); ! } ! catch( Exception e ) { ! throw new PropertyAccessException( e, "Exception occurred", true, clazz, propertyName ); } } + /// <summary></summary> public string PropertyName { *************** *** 39,42 **** --- 49,53 ---- } + /// <summary></summary> public PropertyInfo Property { *************** *** 46,48 **** #endregion } ! } --- 57,59 ---- #endregion } ! } \ No newline at end of file |