C# Class Castle.DynamicProxy.Builder.CodeGenerators.BaseCodeGenerator

Mostrar archivo Open project: nats/castle-1.0.3-mono

Protected Properties

Property Type Description
_baseType System.Type
_cachedFields System.Collections.ArrayList
_interface2mixinIndex System.Collections.Specialized.HybridDictionary
_method2Delegate System.Collections.Hashtable
_method2Invocation Castle.DynamicProxy.Builder.CodeBuilder.EasyMethod
_mixins object[]

Public Methods

Method Description
NoFilterImpl ( Type type, object criteria ) : bool

Protected Methods

Method Description
AddISerializable ( Type interfaces ) : System.Type[]
AddInterfaces ( Type interfacesToAdd, Type interfaces ) : System.Type[]
BaseCodeGenerator ( ModuleScope moduleScope ) : System
BaseCodeGenerator ( ModuleScope moduleScope, GeneratorContext context ) : System
CreateProperty ( PropertyInfo property ) : EasyProperty

Generate property implementation

CreateType ( ) : Type
CreateTypeBuilder ( String typeName, Type baseType, Type interfaces ) : EasyType
CustomizeGetObjectData ( Castle.DynamicProxy.Builder.CodeBuilder.AbstractCodeBuilder codebuilder, ArgumentReference arg1, ArgumentReference arg2 ) : void
Filter ( Type mixinInterfaces ) : System.Type[]
GenerateCallbackMethodIfNecessary ( MethodInfo method, Reference invocationTarget ) : MethodInfo
GenerateConstructor ( ) : EasyConstructor

Generates one public constructor receiving the IInterceptor instance and instantiating a hashtable

Should be overrided to provided specific semantics, if necessary

GenerateConstructorCode ( ConstructorCodeBuilder codebuilder, Reference interceptorArg, Reference targetArgument, Reference mixinArray ) : void

Common initializatio code for the default constructor

GenerateFields ( ) : void
GenerateInterfaceImplementation ( Type interfaces ) : void

GenerateMethodImplementation ( MethodInfo method, EasyProperty properties ) : void

Generates implementation for each method.

GenerateMethods ( Type inter, EasyProperty properties ) : void
GenerateProperties ( Type inter ) : Castle.DynamicProxy.Builder.CodeBuilder.EasyProperty[]
GenerateTypeImplementation ( Type type, bool ignoreInterfaces ) : void

Iterates over the interfaces and generate implementation for each method in it.

GenerateTypeName ( Type type, Type interfaces ) : String
GetCorrectMethod ( MethodInfo method ) : MethodInfo
GetFromCache ( Type baseClass, Type interfaces ) : Type
GetPseudoInvocationTarget ( MethodInfo method ) : Castle.DynamicProxy.Builder.CodeBuilder.SimpleAST.Expression
GetTypeName ( Type type ) : String

Gets the name of a type, taking into consideration nested types.

ImplementCacheInvocationCache ( ) : void
ImplementGetObjectData ( Type interfaces ) : void
InspectAndRegisterInterfaces ( object mixins ) : System.Type[]
IsInternalToDynamicProxy ( Assembly asm ) : bool
NormalizeNamespaceName ( String nsName ) : String

Naive implementation, but valid for long namespaces Works by using only the last piece of the namespace

ObtainAvailableConstructor ( Type target ) : ConstructorInfo
ObtainCallableFieldBuilderDelegate ( EasyCallable builder ) : FieldReference
PostProcessMethod ( MethodInfo method ) : void
PreProcessMethod ( MethodInfo method ) : void
RegisterDelegateFieldToBeInitialized ( MethodInfo method, FieldReference field, EasyCallable builder, MethodInfo callbackMethod ) : void
RegisterInCache ( Type generatedType ) : void
WriteInterceptorInvocationMethod ( MethodInfo method, Castle.DynamicProxy.Builder.CodeBuilder.EasyMethod builder ) : void

Writes the method implementation. This method generates the IL code for property get/set method and ordinary methods.

Private Methods

Method Description
ObtainMethodAttributes ( MethodInfo method ) : MethodAttributes

Method Details

AddISerializable() protected method

protected AddISerializable ( Type interfaces ) : System.Type[]
interfaces System.Type
return System.Type[]

AddInterfaces() protected method

protected AddInterfaces ( Type interfacesToAdd, Type interfaces ) : System.Type[]
interfacesToAdd System.Type
interfaces System.Type
return System.Type[]

BaseCodeGenerator() protected method

protected BaseCodeGenerator ( ModuleScope moduleScope ) : System
moduleScope ModuleScope
return System

BaseCodeGenerator() protected method

protected BaseCodeGenerator ( ModuleScope moduleScope, GeneratorContext context ) : System
moduleScope ModuleScope
context GeneratorContext
return System

CreateProperty() protected method

Generate property implementation
protected CreateProperty ( PropertyInfo property ) : EasyProperty
property System.Reflection.PropertyInfo
return Castle.DynamicProxy.Builder.CodeBuilder.EasyProperty

CreateType() protected method

protected CreateType ( ) : Type
return System.Type

CreateTypeBuilder() protected method

protected CreateTypeBuilder ( String typeName, Type baseType, Type interfaces ) : EasyType
typeName String
baseType System.Type
interfaces System.Type
return Castle.DynamicProxy.Builder.CodeBuilder.EasyType

CustomizeGetObjectData() protected method

protected CustomizeGetObjectData ( Castle.DynamicProxy.Builder.CodeBuilder.AbstractCodeBuilder codebuilder, ArgumentReference arg1, ArgumentReference arg2 ) : void
codebuilder Castle.DynamicProxy.Builder.CodeBuilder.AbstractCodeBuilder
arg1 Castle.DynamicProxy.Builder.CodeBuilder.SimpleAST.ArgumentReference
arg2 Castle.DynamicProxy.Builder.CodeBuilder.SimpleAST.ArgumentReference
return void

Filter() protected method

protected Filter ( Type mixinInterfaces ) : System.Type[]
mixinInterfaces System.Type
return System.Type[]

GenerateCallbackMethodIfNecessary() protected method

protected GenerateCallbackMethodIfNecessary ( MethodInfo method, Reference invocationTarget ) : MethodInfo
method System.Reflection.MethodInfo
invocationTarget Reference
return System.Reflection.MethodInfo

GenerateConstructor() protected method

Generates one public constructor receiving the IInterceptor instance and instantiating a hashtable
Should be overrided to provided specific semantics, if necessary
protected GenerateConstructor ( ) : EasyConstructor
return Castle.DynamicProxy.Builder.CodeBuilder.EasyConstructor

GenerateConstructorCode() protected method

Common initializatio code for the default constructor
protected GenerateConstructorCode ( ConstructorCodeBuilder codebuilder, Reference interceptorArg, Reference targetArgument, Reference mixinArray ) : void
codebuilder Castle.DynamicProxy.Builder.CodeBuilder.ConstructorCodeBuilder
interceptorArg Reference
targetArgument Reference
mixinArray Reference
return void

GenerateFields() protected method

protected GenerateFields ( ) : void
return void

GenerateInterfaceImplementation() protected method

protected GenerateInterfaceImplementation ( Type interfaces ) : void
interfaces System.Type
return void

GenerateMethodImplementation() protected method

Generates implementation for each method.
protected GenerateMethodImplementation ( MethodInfo method, EasyProperty properties ) : void
method System.Reflection.MethodInfo
properties Castle.DynamicProxy.Builder.CodeBuilder.EasyProperty
return void

GenerateMethods() protected method

protected GenerateMethods ( Type inter, EasyProperty properties ) : void
inter System.Type
properties Castle.DynamicProxy.Builder.CodeBuilder.EasyProperty
return void

GenerateProperties() protected method

protected GenerateProperties ( Type inter ) : Castle.DynamicProxy.Builder.CodeBuilder.EasyProperty[]
inter System.Type
return Castle.DynamicProxy.Builder.CodeBuilder.EasyProperty[]

GenerateTypeImplementation() protected method

Iterates over the interfaces and generate implementation for each method in it.
protected GenerateTypeImplementation ( Type type, bool ignoreInterfaces ) : void
type System.Type Type class
ignoreInterfaces bool if true, we inspect the /// type for implemented interfaces
return void

GenerateTypeName() protected abstract method

protected abstract GenerateTypeName ( Type type, Type interfaces ) : String
type System.Type
interfaces System.Type
return String

GetCorrectMethod() protected method

protected GetCorrectMethod ( MethodInfo method ) : MethodInfo
method System.Reflection.MethodInfo
return System.Reflection.MethodInfo

GetFromCache() protected method

protected GetFromCache ( Type baseClass, Type interfaces ) : Type
baseClass System.Type
interfaces System.Type
return System.Type

GetPseudoInvocationTarget() protected method

protected GetPseudoInvocationTarget ( MethodInfo method ) : Castle.DynamicProxy.Builder.CodeBuilder.SimpleAST.Expression
method System.Reflection.MethodInfo
return Castle.DynamicProxy.Builder.CodeBuilder.SimpleAST.Expression

GetTypeName() protected method

Gets the name of a type, taking into consideration nested types.
protected GetTypeName ( Type type ) : String
type System.Type
return String

ImplementCacheInvocationCache() protected method

protected ImplementCacheInvocationCache ( ) : void
return void

ImplementGetObjectData() protected method

protected ImplementGetObjectData ( Type interfaces ) : void
interfaces System.Type
return void

InspectAndRegisterInterfaces() protected method

protected InspectAndRegisterInterfaces ( object mixins ) : System.Type[]
mixins object
return System.Type[]

IsInternalToDynamicProxy() protected method

protected IsInternalToDynamicProxy ( Assembly asm ) : bool
asm System.Reflection.Assembly
return bool

NoFilterImpl() public static method

public static NoFilterImpl ( Type type, object criteria ) : bool
type System.Type
criteria object
return bool

NormalizeNamespaceName() protected method

Naive implementation, but valid for long namespaces Works by using only the last piece of the namespace
protected NormalizeNamespaceName ( String nsName ) : String
nsName String
return String

ObtainAvailableConstructor() protected method

protected ObtainAvailableConstructor ( Type target ) : ConstructorInfo
target System.Type
return System.Reflection.ConstructorInfo

ObtainCallableFieldBuilderDelegate() protected method

protected ObtainCallableFieldBuilderDelegate ( EasyCallable builder ) : FieldReference
builder Castle.DynamicProxy.Builder.CodeBuilder.EasyCallable
return Castle.DynamicProxy.Builder.CodeBuilder.SimpleAST.FieldReference

PostProcessMethod() protected method

protected PostProcessMethod ( MethodInfo method ) : void
method System.Reflection.MethodInfo
return void

PreProcessMethod() protected method

protected PreProcessMethod ( MethodInfo method ) : void
method System.Reflection.MethodInfo
return void

RegisterDelegateFieldToBeInitialized() protected method

protected RegisterDelegateFieldToBeInitialized ( MethodInfo method, FieldReference field, EasyCallable builder, MethodInfo callbackMethod ) : void
method System.Reflection.MethodInfo
field Castle.DynamicProxy.Builder.CodeBuilder.SimpleAST.FieldReference
builder Castle.DynamicProxy.Builder.CodeBuilder.EasyCallable
callbackMethod System.Reflection.MethodInfo
return void

RegisterInCache() protected method

protected RegisterInCache ( Type generatedType ) : void
generatedType System.Type
return void

WriteInterceptorInvocationMethod() protected method

Writes the method implementation. This method generates the IL code for property get/set method and ordinary methods.
protected WriteInterceptorInvocationMethod ( MethodInfo method, Castle.DynamicProxy.Builder.CodeBuilder.EasyMethod builder ) : void
method System.Reflection.MethodInfo The method to implement.
builder Castle.DynamicProxy.Builder.CodeBuilder.EasyMethod being constructed.
return void

Property Details

_baseType protected_oe property

protected Type,System _baseType
return System.Type

_cachedFields protected_oe property

Holds instance fields which points to delegates instantiated
protected ArrayList,System.Collections _cachedFields
return System.Collections.ArrayList

_interface2mixinIndex protected_oe property

protected HybridDictionary,System.Collections.Specialized _interface2mixinIndex
return System.Collections.Specialized.HybridDictionary

_method2Delegate protected_oe property

MethodInfo => Callable delegate
protected Hashtable,System.Collections _method2Delegate
return System.Collections.Hashtable

_method2Invocation protected_oe property

protected EasyMethod,Castle.DynamicProxy.Builder.CodeBuilder _method2Invocation
return Castle.DynamicProxy.Builder.CodeBuilder.EasyMethod

_mixins protected_oe property

protected object[] _mixins
return object[]