C# Class NVelocity.Util.Introspection.MethodMap

显示文件 Open project: rasmus-toftdahl-olesen/NVelocity Class Usage Examples

Public Methods

Method Description
Add ( MethodInfo method ) : void

Add a method to a list of methods by name. For a particular class we are keeping track of all the methods with the same name.

Find ( String methodName, Object args ) : MethodInfo

Find a method. Attempts to find the most specific applicable method using the algorithm described in the JLS section 15.12.2 (with the exception that it can't distinguish a primitive type argument from an object type argument, since in reflection primitive type arguments are represented by their object counterparts, so for an argument of type (say) java.lang.Integer, it will not be able to decide between a method that takes int and a method that takes java.lang.Integer as a parameter.

This turns out to be a relatively rare case where this is needed - however, functionality like this is needed.

Get ( String key ) : IList

Return a list of methods with the same name.

Private Methods

Method Description
CreateDescriptiveAmbiguousErrorMessage ( IList list, Type classes ) : string
CreateParametersDescription ( ParameterInfo parameters ) : String
GetApplicables ( IList methods, Type classes ) : ArrayList

Returns all methods that are applicable to actual argument types.

GetMostSpecific ( IList methods, Type classes ) : MethodInfo
IsApplicable ( MethodInfo method, Type classes ) : bool

Returns true if the supplied method is applicable to actual argument types.

IsMethodInvocationConvertible ( ParameterInfo formal, Type actual ) : bool

Determines whether a type represented by a class object is convertible to another type represented by a class object using a method invocation conversion, treating object types of primitive types as if they were primitive types (that is, a Boolean actual parameter type matches boolean primitive formal type). This behavior is because this method is used to determine applicable methods for an actual parameter list, and primitive types are represented by their object duals in reflective method calls.

IsMoreSpecific ( ParameterInfo c1, ParameterInfo c2 ) : int

Determines which method signature (represented by a class array) is more specific. This defines a partial ordering on the method signatures.

IsStrictMethodInvocationConvertible ( ParameterInfo formal, ParameterInfo actual ) : bool

Determines whether a type represented by a class object is convertible to another type represented by a class object using a method invocation conversion, without matching object and primitive types. This method is used to determine the more specific type when comparing signatures of methods.

Method Details

Add() public method

Add a method to a list of methods by name. For a particular class we are keeping track of all the methods with the same name.
public Add ( MethodInfo method ) : void
method MethodInfo
return void

Find() public method

Find a method. Attempts to find the most specific applicable method using the algorithm described in the JLS section 15.12.2 (with the exception that it can't distinguish a primitive type argument from an object type argument, since in reflection primitive type arguments are represented by their object counterparts, so for an argument of type (say) java.lang.Integer, it will not be able to decide between a method that takes int and a method that takes java.lang.Integer as a parameter.

This turns out to be a relatively rare case where this is needed - however, functionality like this is needed.

if there is more than one maximally specific applicable method
public Find ( String methodName, Object args ) : MethodInfo
methodName String name of method
args Object the actual arguments with which the method is called
return MethodInfo

Get() public method

Return a list of methods with the same name.
public Get ( String key ) : IList
key String key
return IList