/// <summary> /// Initializes the static members in <see cref="PropertyAccessorFactory"/>. /// </summary> static PropertyAccessorFactory() { accessors = new Hashtable(13); accessors["property"] = new BasicPropertyAccessor(); accessors["field"] = new FieldAccessor(); accessors["field.camelcase"] = new FieldAccessor(new CamelCaseStrategy()); accessors["field.camelcase-underscore"] = new FieldAccessor(new CamelCaseUnderscoreStrategy()); accessors["field.lowercase"] = new FieldAccessor(new LowerCaseStrategy()); accessors["field.lowercase-underscore"] = new FieldAccessor(new LowerCaseUnderscoreStrategy()); accessors["field.pascalcase-underscore"] = new FieldAccessor(new PascalCaseUnderscoreStrategy()); accessors["field.pascalcase-m-underscore"] = new FieldAccessor(new PascalCaseMUnderscoreStrategy()); accessors["nosetter.camelcase"] = new NoSetterAccessor(new CamelCaseStrategy()); accessors["nosetter.camelcase-underscore"] = new NoSetterAccessor(new CamelCaseUnderscoreStrategy()); accessors["nosetter.lowercase"] = new NoSetterAccessor(new LowerCaseStrategy()); accessors["nosetter.lowercase-underscore"] = new NoSetterAccessor(new LowerCaseUnderscoreStrategy()); accessors["nosetter.pascalcase-underscore"] = new NoSetterAccessor(new PascalCaseUnderscoreStrategy()); accessors["nosetter.pascalcase-m-underscore"] = new NoSetterAccessor(new PascalCaseMUnderscoreStrategy()); }
/// <summary> /// Initializes the static members in <see cref="PropertyAccessorFactory"/>. /// </summary> static PropertyAccessorFactory() { accessors = new Hashtable( 13 ); accessors[ "property" ] = new BasicPropertyAccessor(); accessors[ "field" ] = new FieldAccessor(); accessors[ "field.camelcase" ] = new FieldAccessor( new CamelCaseStrategy() ); accessors[ "field.camelcase-underscore" ] = new FieldAccessor( new CamelCaseUnderscoreStrategy() ); accessors[ "field.lowercase" ] = new FieldAccessor( new LowerCaseStrategy() ); accessors[ "field.lowercase-underscore" ] = new FieldAccessor( new LowerCaseUnderscoreStrategy() ); accessors[ "field.pascalcase-underscore" ] = new FieldAccessor( new PascalCaseUnderscoreStrategy() ); accessors[ "field.pascalcase-m-underscore" ] = new FieldAccessor( new PascalCaseMUnderscoreStrategy() ); accessors[ "nosetter.camelcase" ] = new NoSetterAccessor( new CamelCaseStrategy() ); accessors[ "nosetter.camelcase-underscore" ] = new NoSetterAccessor( new CamelCaseUnderscoreStrategy() ); accessors[ "nosetter.lowercase" ] = new NoSetterAccessor( new LowerCaseStrategy() ); accessors[ "nosetter.lowercase-underscore" ] = new NoSetterAccessor( new LowerCaseUnderscoreStrategy() ); accessors[ "nosetter.pascalcase-underscore" ] = new NoSetterAccessor( new PascalCaseUnderscoreStrategy() ); accessors[ "nosetter.pascalcase-m-underscore" ] = new NoSetterAccessor( new PascalCaseMUnderscoreStrategy() ); }
/// <summary> /// Create a <see cref="FieldSetter"/> to <c>set</c> the value of the mapped Property /// through a <c>Field</c>. /// </summary> /// <param name="type">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 type, string propertyName) { string fieldName = namingStrategy.GetFieldName(propertyName); return(new FieldSetter(FieldAccessor.GetField(type, fieldName), type, fieldName)); }