FindMethod() public method

Find a Method using the methodKey provided. Look in the methodMap for an entry. If found, it'll either be a CACHE_MISS, in which case we simply give up, or it'll be a Method, in which case, we return it. If nothing is found, then we must actually go and introspect the method from the MethodMap.
public FindMethod ( String name, Object parameters ) : MethodInfo
name String
parameters Object
return System.Reflection.MethodInfo
Esempio n. 1
0
        public System.Reflection.MethodInfo FindMethod(string name, object[] parameters)
        {
            var methodInfo = _classMap.FindMethod(name, parameters);

            if (methodInfo == null)
            {
                return(new DynamicMethodInfo(_type, name));
            }
            else
            {
                return(methodInfo);
            }
        }
Esempio n. 2
0
        /// <summary> Gets the method defined by <code>name</code> and
        /// <code>params</code> for the Class <code>c</code>.
        ///
        /// </summary>
        /// <param name="c">Class in which the method search is taking place
        /// </param>
        /// <param name="name">Name of the method being searched for
        /// </param>
        /// <param name="params">An array of Objects (not Classes) that describe the
        /// the parameters
        ///
        /// </param>
        /// <returns> The desired Method object.
        /// </returns>
        /// <throws>  IllegalArgumentException When the parameters passed in can not be used for introspection. </throws>
        /// <throws>  MethodMap.AmbiguousException When the method map contains more than one match for the requested signature. </throws>
        public virtual MethodEntry GetMethod(Type c, string name, object[] parameters)
        {
            if (c == null)
            {
                throw new System.ArgumentException("class object is null!");
            }

            IIntrospectorCache ic = IntrospectorCache;

            ClassMap classMap = ic.Get(c);

            if (classMap == null)
            {
                classMap = ic.Put(c);
            }

            return(classMap.FindMethod(name, parameters));
        }
Esempio n. 3
0
        public virtual MethodInfo GetMethod(Type c, string name, object[] parameters)
        {
            if (c == null)
            {
                throw new System.Exception("Introspector.getMethod(): Class method key was null: " + name);
            }
            ClassMap classMap = null;

            lock (this.classMethodMaps)
            {
                classMap = (ClassMap)this.classMethodMaps[c];
                if (classMap == null)
                {
                    if (this.cachedClassNames.Contains(c.FullName))
                    {
                        this.ClearCache();
                    }
                    classMap = this.CreateClassMap(c);
                }
            }
            return(classMap.FindMethod(name, parameters));
        }