C# Class Spring.Objects.Factory.Support.MethodInjectingInstantiationStrategy.MethodInjectingTypeBuilder

A System.Type factory that generates subclasses of those classes that have been configured for the Method-Injection form of Dependency Injection.

This class is designed as for one-shot usage; i.e. it must be used to generate exactly one method injected subclass and then discarded (it maintains state in instance fields).

Show file Open project: spring-projects/spring-net

Private Properties

Property Type Description
CalculateMethodAttributes MethodAttributes
DefineConstructors System.Reflection.Emit.TypeBuilder
DefineFields System.Reflection.Emit.TypeBuilder
DefineMethods System.Reflection.Emit.TypeBuilder
DefineProperties System.Reflection.Emit.TypeBuilder
DefineReplacedMethod void
DefineReturnValueIfAny System.Reflection.Emit.LocalBuilder
DefineType System.Reflection.Emit.TypeBuilder
DefineWritePropertyForMethodReplacement void
PushArguments void
SetupTheReturnValueIfAny void

Public Methods

Method Description
BuildType ( ) : Type

Builds a System.Type suitable for Method-Injection.

MethodInjectingTypeBuilder ( ModuleBuilder module, Spring.Objects.Factory.Support.RootObjectDefinition objectDefinition ) : System

Creates a new instance of the MethodInjectingTypeBuilder class.

Private Methods

Method Description
CalculateMethodAttributes ( MethodInfo method ) : MethodAttributes
DefineConstructors ( TypeBuilder typeBuilder ) : TypeBuilder
DefineFields ( TypeBuilder typeBuilder ) : TypeBuilder
DefineMethods ( TypeBuilder typeBuilder ) : TypeBuilder

Defines overrides for those methods that are configured with an appropriate Spring.Objects.Factory.Support.MethodOverride.

DefineProperties ( TypeBuilder typeBuilder ) : TypeBuilder
DefineReplacedMethod ( TypeBuilder typeBuilder, MethodInfo method, FieldBuilder field ) : void

Override the supplied method with the logic encapsulated by the Spring.Objects.Factory.Support.IMethodReplacer defined by the supplied field.

DefineReturnValueIfAny ( MethodInfo method, ILGenerator il ) : LocalBuilder

Generates the MSIL for a return value if the supplied method returns a value.

DefineType ( ) : TypeBuilder
DefineWritePropertyForMethodReplacement ( TypeBuilder typeBuilder, string propertyName, FieldBuilder field ) : void

Simply generates the IL for a write only property for the IMethodReplacer System.Type.

PushArguments ( ParameterInfo methodParameters, ILGenerator il ) : void

Pushes (sets up) the arguments for a call to the Spring.Objects.Factory.Support.IMethodReplacer.Implement(object, MethodInfo, object[]) method of an appropriate Spring.Objects.Factory.Support.IMethodReplacer.

SetupTheReturnValueIfAny ( LocalBuilder returnValue, ILGenerator il ) : void

Generates the MSIL for actually returning a return value if the supplied returnValue is not .

Method Details

BuildType() public method

Builds a System.Type suitable for Method-Injection.
public BuildType ( ) : Type
return System.Type

MethodInjectingTypeBuilder() public method

Creates a new instance of the MethodInjectingTypeBuilder class.
/// If either of the supplied arguments is . ///
public MethodInjectingTypeBuilder ( ModuleBuilder module, Spring.Objects.Factory.Support.RootObjectDefinition objectDefinition ) : System
module System.Reflection.Emit.ModuleBuilder /// The in which /// the generated is to be defined. ///
objectDefinition Spring.Objects.Factory.Support.RootObjectDefinition /// The object definition that is the target of the method injection. ///
return System