From: Michael D. <mik...@us...> - 2005-01-14 00:28:42
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Property In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13039/NHibernate/Property Modified Files: BasicPropertyAccessor.cs BasicSetter.cs CamelCaseStrategy.cs CamelCaseUnderscoreStrategy.cs FieldAccessor.cs IFieldNamingStrategy.cs IPropertyAccessor.cs LowerCaseUnderscoreStrategy.cs NoSetterAccessor.cs PascalCaseMUnderscoreStrategy.cs PropertyAccessorFactory.cs Log Message: Added some xml comments. Index: BasicPropertyAccessor.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Property/BasicPropertyAccessor.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BasicPropertyAccessor.cs 13 Jan 2005 20:55:16 -0000 1.4 --- BasicPropertyAccessor.cs 14 Jan 2005 00:28:25 -0000 1.5 *************** *** 18,22 **** /// </summary> /// <param name="theClass">The <see cref="System.Type"/> to find the Property in.</param> ! /// <param name="propertyName">The name of the Property to get.</param> /// <returns> /// The <see cref="BasicGetter"/> to use to get the value of the Property from an --- 18,22 ---- /// </summary> /// <param name="theClass">The <see cref="System.Type"/> to find the Property in.</param> ! /// <param name="propertyName">The name of the mapped Property to get.</param> /// <returns> /// The <see cref="BasicGetter"/> to use to get the value of the Property from an *************** *** 40,44 **** /// </summary> /// <param name="type">The <see cref="System.Type"/> to find the Property in.</param> ! /// <param name="propertyName">The name of the Property to get.</param> /// <returns> /// The <see cref="BasicSetter"/> to use to set the value of the Property on an --- 40,44 ---- /// </summary> /// <param name="type">The <see cref="System.Type"/> to find the Property in.</param> ! /// <param name="propertyName">The name of the mapped Property to get.</param> /// <returns> /// The <see cref="BasicSetter"/> to use to set the value of the Property on an *************** *** 65,69 **** /// </summary> /// <param name="type">The <see cref="System.Type"/> to find the Property in.</param> ! /// <param name="propertyName">The name of the Property to get.</param> /// <returns> /// The <see cref="BasicGetter"/> for the Property <c>get</c> or <c>null</c> --- 65,69 ---- /// </summary> /// <param name="type">The <see cref="System.Type"/> to find the Property in.</param> ! /// <param name="propertyName">The name of the mapped Property to get.</param> /// <returns> /// The <see cref="BasicGetter"/> for the Property <c>get</c> or <c>null</c> *************** *** 110,114 **** /// </summary> /// <param name="type">The <see cref="System.Type"/> to find the Property in.</param> ! /// <param name="propertyName">The name of the Property to set.</param> /// <returns> /// The <see cref="BasicSetter"/> for the Property <c>set</c> or <c>null</c> --- 110,114 ---- /// </summary> /// <param name="type">The <see cref="System.Type"/> to find the Property in.</param> ! /// <param name="propertyName">The name of the mapped Property to set.</param> /// <returns> /// The <see cref="BasicSetter"/> for the Property <c>set</c> or <c>null</c> Index: CamelCaseUnderscoreStrategy.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Property/CamelCaseUnderscoreStrategy.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CamelCaseUnderscoreStrategy.cs 31 Dec 2004 21:55:49 -0000 1.2 --- CamelCaseUnderscoreStrategy.cs 14 Jan 2005 00:28:26 -0000 1.3 *************** *** 2,6 **** { /// <summary> ! /// Implementation of FieldNamingStrategy for fields that are prefixed with /// an underscore and the PropertyName is changed to camelCase. /// </summary> --- 2,6 ---- { /// <summary> ! /// Implementation of <see cref="IFieldNamingStrategy"/> for fields that are prefixed with /// an underscore and the PropertyName is changed to camelCase. /// </summary> *************** *** 10,17 **** /// <summary> ! /// /// </summary> ! /// <param name="propertyName"></param> ! /// <returns></returns> public string GetFieldName( string propertyName ) { --- 10,18 ---- /// <summary> ! /// Converts the Property's name into a Field name by making the first character ! /// of the <c>propertyName</c> lowercase and prefixing it with an underscore. /// </summary> ! /// <param name="propertyName">The name of the mapped property.</param> ! /// <returns>The name of the Field in CamelCase format prefixed with an underscore.</returns> public string GetFieldName( string propertyName ) { Index: IFieldNamingStrategy.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Property/IFieldNamingStrategy.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IFieldNamingStrategy.cs 31 Dec 2004 21:56:10 -0000 1.2 --- IFieldNamingStrategy.cs 14 Jan 2005 00:28:26 -0000 1.3 *************** *** 2,13 **** { /// <summary> ! /// Summary description for IFieldNamingStrategy. /// </summary> public interface IFieldNamingStrategy { /// <summary> ! /// Converts the Property's name into a Field name /// </summary> ! /// <param name="propertyName">The name of the Property.</param> /// <returns>The name of the Field.</returns> string GetFieldName( string propertyName ); --- 2,13 ---- { /// <summary> ! /// A Strategy for converting a mapped property name to a Field name. /// </summary> public interface IFieldNamingStrategy { /// <summary> ! /// When implemented by a class, converts the Property's name into a Field name /// </summary> ! /// <param name="propertyName">The name of the mapped property.</param> /// <returns>The name of the Field.</returns> string GetFieldName( string propertyName ); Index: NoSetterAccessor.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Property/NoSetterAccessor.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NoSetterAccessor.cs 13 Jan 2005 20:55:16 -0000 1.3 --- NoSetterAccessor.cs 14 Jan 2005 00:28:26 -0000 1.4 *************** *** 9,13 **** /// <remarks> /// This is most useful because Classes can provider a get for the Property ! /// that is the <id> but tell NHibernate there is no setter for the Property /// so the value should be written directly to the field. /// </remarks> --- 9,13 ---- /// <remarks> /// This is most useful because Classes can provider a get for the Property ! /// that is the <c><id></c> but tell NHibernate there is no setter for the Property /// so the value should be written directly to the field. /// </remarks> *************** *** 31,35 **** /// </summary> /// <param name="theClass">The <see cref="System.Type"/> to find the Property in.</param> ! /// <param name="propertyName">The name of the Property to get.</param> /// <returns> /// The <see cref="BasicGetter"/> to use to get the value of the Property from an --- 31,35 ---- /// </summary> /// <param name="theClass">The <see cref="System.Type"/> to find the Property in.</param> ! /// <param name="propertyName">The name of the mapped Property to get.</param> /// <returns> /// The <see cref="BasicGetter"/> to use to get the value of the Property from an *************** *** 50,58 **** /// <summary> ! /// Create a <see cref="FieldSetter"/> to <c>set</c> the value of the Property ! /// through a <c>field</c>. /// </summary> ! /// <param name="theClass">The <see cref="System.Type"/> to find the Property in.</param> ! /// <param name="propertyName">The name of the Property to set.</param> /// <returns> /// The <see cref="FieldSetter"/> to use to set the value of the Property on an --- 50,58 ---- /// <summary> ! /// Create a <see cref="FieldSetter"/> to <c>set</c> the value of the mapped Property ! /// through a <c>Field</c>. /// </summary> ! /// <param name="theClass">The <see cref="System.Type"/> to find the mapped Property in.</param> ! /// <param name="propertyName">The name of the mapped Property to set.</param> /// <returns> /// The <see cref="FieldSetter"/> to use to set the value of the Property on an *************** *** 60,64 **** /// </returns> /// <exception cref="PropertyNotFoundException" > ! /// Thrown when a field for the Property specified by the <c>propertyName</c> using the /// <see cref="IFieldNamingStrategy"/> could not be found in the <see cref="System.Type"/>. /// </exception> --- 60,64 ---- /// </returns> /// <exception cref="PropertyNotFoundException" > ! /// Thrown when a Field for the Property specified by the <c>propertyName</c> using the /// <see cref="IFieldNamingStrategy"/> could not be found in the <see cref="System.Type"/>. /// </exception> Index: PropertyAccessorFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Property/PropertyAccessorFactory.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PropertyAccessorFactory.cs 31 Dec 2004 21:56:35 -0000 1.8 --- PropertyAccessorFactory.cs 14 Jan 2005 00:28:26 -0000 1.9 *************** *** 12,16 **** private static IDictionary accessors; ! /// <summary></summary> static PropertyAccessorFactory() { --- 12,18 ---- private static IDictionary accessors; ! /// <summary> ! /// Initializes the static members in <see cref="PropertyAccessorFactory"/>. ! /// </summary> static PropertyAccessorFactory() { Index: IPropertyAccessor.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Property/IPropertyAccessor.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IPropertyAccessor.cs 13 Jan 2005 20:55:16 -0000 1.3 --- IPropertyAccessor.cs 14 Jan 2005 00:28:26 -0000 1.4 *************** *** 13,17 **** /// </summary> /// <param name="theClass">The <see cref="System.Type"/> to find the Property in.</param> ! /// <param name="propertyName">The name of the Property to get.</param> /// <returns> /// The <see cref="IGetter"/> to use to get the value of the Property from an --- 13,17 ---- /// </summary> /// <param name="theClass">The <see cref="System.Type"/> to find the Property in.</param> ! /// <param name="propertyName">The name of the mapped Property to get.</param> /// <returns> /// The <see cref="IGetter"/> to use to get the value of the Property from an *************** *** 27,31 **** /// </summary> /// <param name="theClass">The <see cref="System.Type"/> to find the Property in.</param> ! /// <param name="propertyName">The name of the Property to set.</param> /// <returns> /// The <see cref="ISetter"/> to use to set the value of the Property on an --- 27,31 ---- /// </summary> /// <param name="theClass">The <see cref="System.Type"/> to find the Property in.</param> ! /// <param name="propertyName">The name of the mapped Property to set.</param> /// <returns> /// The <see cref="ISetter"/> to use to set the value of the Property on an Index: PascalCaseMUnderscoreStrategy.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Property/PascalCaseMUnderscoreStrategy.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PascalCaseMUnderscoreStrategy.cs 31 Dec 2004 21:56:35 -0000 1.3 --- PascalCaseMUnderscoreStrategy.cs 14 Jan 2005 00:28:26 -0000 1.4 *************** *** 2,7 **** { /// <summary> ! /// Implementation of FieldNamingStrategy for fields that are prefixed with ! /// an "m_" and the first character in PropertyName capitalized. /// </summary> public class PascalCaseMUnderscoreStrategy : IFieldNamingStrategy --- 2,7 ---- { /// <summary> ! /// Implementation of <see cref="IFieldNamingStrategy"/> for fields that are prefixed with ! /// an <c>m_</c> and the first character in PropertyName capitalized. /// </summary> public class PascalCaseMUnderscoreStrategy : IFieldNamingStrategy *************** *** 10,17 **** /// <summary> ! /// /// </summary> ! /// <param name="propertyName"></param> ! /// <returns></returns> public string GetFieldName( string propertyName ) { --- 10,19 ---- /// <summary> ! /// Converts the Property's name into a Field name by making the first character ! /// of the <c>propertyName</c> uppercase and prefixing it with the letter 'm' ! /// and an underscore. /// </summary> ! /// <param name="propertyName">The name of the mapped property.</param> ! /// <returns>The name of the Field in CamelCase format prefixed with an 'm' and an underscore.</returns> public string GetFieldName( string propertyName ) { Index: FieldAccessor.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Property/FieldAccessor.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FieldAccessor.cs 31 Dec 2004 21:55:49 -0000 1.6 --- FieldAccessor.cs 14 Jan 2005 00:28:26 -0000 1.7 *************** *** 4,14 **** { /// <summary> ! /// Access fields directly. /// </summary> /// <remarks> ! /// This accesses fields with the following naming convention unless a ! /// <see cref="IFieldNamingStrategy"/> is supplied. ! /// Property Name = "Id" ! /// Field Name = "Id" /// </remarks> public class FieldAccessor : IPropertyAccessor --- 4,13 ---- { /// <summary> ! /// Access the mapped property by using a Field to <c>get</c> and <c>set</c> the value. /// </summary> /// <remarks> ! /// The <see cref="FieldAccessor"/> is useful when you expose <c>getter</c> and <c>setters</c> ! /// for a Property, but they have extra code in them that shouldn't be executed when NHibernate ! /// is setting or getting the values for loads or saves. /// </remarks> public class FieldAccessor : IPropertyAccessor *************** *** 16,20 **** private IFieldNamingStrategy namingStrategy; ! /// <summary></summary> public FieldAccessor() { --- 15,21 ---- private IFieldNamingStrategy namingStrategy; ! /// <summary> ! /// Initializes a new instance of <see cref="FieldAccessor"/>. ! /// </summary> public FieldAccessor() { *************** *** 22,28 **** /// <summary> ! /// /// </summary> ! /// <param name="namingStrategy"></param> public FieldAccessor( IFieldNamingStrategy namingStrategy ) { --- 23,29 ---- /// <summary> ! /// Initializes a new instance of <see cref="FieldAccessor"/>. /// </summary> ! /// <param name="namingStrategy">The <see cref="IFieldNamingStrategy"/> to use.</param> public FieldAccessor( IFieldNamingStrategy namingStrategy ) { *************** *** 32,36 **** /// <summary> /// Gets the <see cref="IFieldNamingStrategy"/> used to convert the name of the ! /// Property in the hbm.xml file to the name of the field in the class. /// </summary> /// <value>The <see cref="IFieldNamingStrategy"/> or <c>null</c>.</value> --- 33,37 ---- /// <summary> /// Gets the <see cref="IFieldNamingStrategy"/> used to convert the name of the ! /// mapped Property in the hbm.xml file to the name of the field in the class. /// </summary> /// <value>The <see cref="IFieldNamingStrategy"/> or <c>null</c>.</value> *************** *** 43,51 **** /// <summary> ! /// /// </summary> ! /// <param name="theClass"></param> ! /// <param name="propertyName"></param> ! /// <returns></returns> public IGetter GetGetter( System.Type theClass, string propertyName ) { --- 44,59 ---- /// <summary> ! /// Create a <see cref="FieldGetter"/> to <c>get</c> the value of the mapped Property ! /// through a <c>Field</c>. /// </summary> ! /// <param name="theClass">The <see cref="System.Type"/> to find the Property in.</param> ! /// <param name="propertyName">The name of the mapped Property to get.</param> ! /// <returns> ! /// The <see cref="FieldGetter"/> to use to get the value of the Property from an ! /// instance of the <see cref="System.Type"/>.</returns> ! /// <exception cref="PropertyNotFoundException" > ! /// Thrown when a Field specified by the <c>propertyName</c> could not ! /// be found in the <see cref="System.Type"/>. ! /// </exception> public IGetter GetGetter( System.Type theClass, string propertyName ) { *************** *** 55,63 **** /// <summary> ! /// /// </summary> ! /// <param name="theClass"></param> ! /// <param name="propertyName"></param> ! /// <returns></returns> public ISetter GetSetter( System.Type theClass, string propertyName ) { --- 63,79 ---- /// <summary> ! /// Create a <see cref="FieldSetter"/> to <c>set</c> the value of the mapped Property ! /// through a <c>Field</c>. /// </summary> ! /// <param name="theClass">The <see cref="System.Type"/> to find the mapped Property in.</param> ! /// <param name="propertyName">The name of the mapped Property to set.</param> ! /// <returns> ! /// The <see cref="FieldSetter"/> to use to set the value of the Property on an ! /// instance of the <see cref="System.Type"/>. ! /// </returns> ! /// <exception cref="PropertyNotFoundException" > ! /// Thrown when a Field for the Property specified by the <c>propertyName</c> using the ! /// <see cref="IFieldNamingStrategy"/> could not be found in the <see cref="System.Type"/>. ! /// </exception> public ISetter GetSetter( System.Type theClass, string propertyName ) { *************** *** 69,81 **** /// <summary> ! /// /// </summary> ! /// <param name="clazz"></param> ! /// <param name="fieldName"></param> ! /// <returns></returns> internal static FieldInfo GetField( System.Type clazz, string fieldName ) { if( clazz == null || clazz == typeof( object ) ) { throw new PropertyNotFoundException( "field not found: " + fieldName ); } --- 85,104 ---- /// <summary> ! /// Helper method to find the Field. /// </summary> ! /// <param name="clazz">The <see cref="System.Type"/> to find the Field in.</param> ! /// <param name="fieldName">The name of the Field to find.</param> ! /// <returns> ! /// The <see cref="FieldInfo"/> for the field. ! /// </returns> ! /// <exception cref="PropertyNotFoundException"> ! /// Thrown when a field could not be found. ! /// </exception> internal static FieldInfo GetField( System.Type clazz, string fieldName ) { if( clazz == null || clazz == typeof( object ) ) { + // the full inheritance chain has been walked and we could + // not find the Field throw new PropertyNotFoundException( "field not found: " + fieldName ); } *************** *** 84,87 **** --- 107,111 ---- if( field == null ) { + // recursively call this method for the base Type field = GetField( clazz.BaseType, fieldName ); } *************** *** 94,104 **** /// <summary> ! /// Converts the Property's name into a Field using camel style casing. /// </summary> /// <param name="propertyName">The name of the Property.</param> /// <returns>The name of the Field.</returns> - /// <remarks> - /// This uses the convention that a Property named <c>Id</c> will have a field <c>id</c> - /// </remarks> private string GetFieldName( string propertyName ) { --- 118,126 ---- /// <summary> ! /// Converts the mapped property's name into a Field using ! /// the <see cref="IFieldNamingStrategy"/> if one exists. /// </summary> /// <param name="propertyName">The name of the Property.</param> /// <returns>The name of the Field.</returns> private string GetFieldName( string propertyName ) { Index: CamelCaseStrategy.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Property/CamelCaseStrategy.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CamelCaseStrategy.cs 31 Dec 2004 21:55:49 -0000 1.2 --- CamelCaseStrategy.cs 14 Jan 2005 00:28:26 -0000 1.3 *************** *** 2,7 **** { /// <summary> ! /// Implementation of FieldNamingStrategy for fields that are the ! /// Camel Case version of the PropertyName /// </summary> public class CamelCaseStrategy : IFieldNamingStrategy --- 2,7 ---- { /// <summary> ! /// Implementation of <see cref="IFieldNamingStrategy"/> for fields that are the ! /// camelCase version of the PropertyName /// </summary> public class CamelCaseStrategy : IFieldNamingStrategy *************** *** 10,17 **** /// <summary> ! /// /// </summary> ! /// <param name="propertyName"></param> ! /// <returns></returns> public string GetFieldName( string propertyName ) { --- 10,18 ---- /// <summary> ! /// Converts the Property's name into a Field name by making the first character ! /// lower case. /// </summary> ! /// <param name="propertyName">The name of the mapped property.</param> ! /// <returns>The name of the Field in CamelCase format.</returns> public string GetFieldName( string propertyName ) { Index: LowerCaseUnderscoreStrategy.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Property/LowerCaseUnderscoreStrategy.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LowerCaseUnderscoreStrategy.cs 31 Dec 2004 21:56:23 -0000 1.2 --- LowerCaseUnderscoreStrategy.cs 14 Jan 2005 00:28:26 -0000 1.3 *************** *** 2,6 **** { /// <summary> ! /// Implementation of FieldNamingStrategy for fields that are prefixed with /// an underscore and the PropertyName is changed to lower case. /// </summary> --- 2,6 ---- { /// <summary> ! /// Implementation of <see cref="IFieldNamingStrategy"/> for fields that are prefixed with /// an underscore and the PropertyName is changed to lower case. /// </summary> *************** *** 10,17 **** /// <summary> ! /// /// </summary> ! /// <param name="propertyName"></param> ! /// <returns></returns> public string GetFieldName( string propertyName ) { --- 10,18 ---- /// <summary> ! /// Converts the Property's name into a Field name by making the all characters ! /// of the <c>propertyName</c> lowercase and prefixing it with an underscore. /// </summary> ! /// <param name="propertyName">The name of the mapped property.</param> ! /// <returns>The name of the Field in lowercase prefixed with an underscore.</returns> public string GetFieldName( string propertyName ) { Index: BasicSetter.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Property/BasicSetter.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BasicSetter.cs 13 Jan 2005 20:55:16 -0000 1.3 --- BasicSetter.cs 14 Jan 2005 00:28:26 -0000 1.4 *************** *** 18,22 **** /// <param name="clazz">The <see cref="System.Type"/> that contains the Property <c>set</c>.</param> /// <param name="property">The <see cref="PropertyInfo"/> for reflection.</param> ! /// <param name="propertyName">The name of the Property.</param> public BasicSetter( System.Type clazz, PropertyInfo property, string propertyName ) { --- 18,22 ---- /// <param name="clazz">The <see cref="System.Type"/> that contains the Property <c>set</c>.</param> /// <param name="property">The <see cref="PropertyInfo"/> for reflection.</param> ! /// <param name="propertyName">The name of the mapped Property.</param> public BasicSetter( System.Type clazz, PropertyInfo property, string propertyName ) { *************** *** 49,55 **** /// <summary> ! /// Gets the name of the Property. /// </summary> ! /// <value>The name of the Property or <c>null</c>.</value> public string PropertyName { --- 49,55 ---- /// <summary> ! /// Gets the name of the mapped Property. /// </summary> ! /// <value>The name of the mapped Property or <c>null</c>.</value> public string PropertyName { *************** *** 58,64 **** /// <summary> ! /// Gets the <see cref="PropertyInfo"/> for the Property. /// </summary> ! /// <value>The <see cref="PropertyInfo"/> for the Property.</value> public PropertyInfo Property { --- 58,64 ---- /// <summary> ! /// Gets the <see cref="PropertyInfo"/> for the mapped Property. /// </summary> ! /// <value>The <see cref="PropertyInfo"/> for the mapped Property.</value> public PropertyInfo Property { |