A cache of introspection information for a specific class instance. Keys {@link java.lang.Method} objects by a concatenation of the method name and the names of classes that make up the parameters.
Ejemplo n.º 1
0
        public virtual PropertyInfo GetProperty(Type c, string name)
        {
            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.FindProperty(name));
        }
        /// <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>
        public virtual MethodInfo getMethod(Type c, String name, Object[] params_Renamed)
        {
            if (c == null)
            {
                throw new Exception("Introspector.getMethod(): Class method key was null: " + name);
            }

            ClassMap classMap = null;

            lock (classMethodMaps)
            {
                classMap = (ClassMap)classMethodMaps[c];

                /*
                 *  if we don't have this, check to see if we have it
                 *  by name.  if so, then we have a classloader change
                 *  so dump our caches.
                 */

                if (classMap == null)
                {
                    if (cachedClassNames.Contains(c.FullName))
                    {
                        /*
                         * we have a map for a class with same name, but not
                         * this class we are looking at.  This implies a
                         * classloader change, so dump
                         */
                        clearCache();
                    }

                    classMap = createClassMap(c);
                }
            }

            return(classMap.findMethod(name, params_Renamed));
        }
Ejemplo n.º 3
0
 public DynamicClassMap(Type t)
 {
     _classMap = new ClassMap(t);
     _type     = t;
 }
Ejemplo n.º 4
0
		/// <summary>
		/// Creates a class map for specific class and registers it in the
		/// cache.  Also adds the qualified name to the name->class map
		/// for later Classloader change detection.
		/// </summary>
		protected internal ClassMap CreateClassMap(Type c)
		{
			ClassMap classMap = new ClassMap(c);

			classMethodMaps[c] = classMap;
			cachedClassNames.Add(c.FullName);

			return classMap;
		}