jvanzyl     00/10/09 08:10:29

  Added:       src/java/org/apache/velocity/util Introspector.java
  Log:
  - super simple introspector. a little experiment. no parameter
    list comparision. probably going to use the MethodMatcher
    utility from Tea for this.
  
  Revision  Changes    Path
  1.1                  
jakarta-velocity/src/java/org/apache/velocity/util/Introspector.java
  
  Index: Introspector.java
  ===================================================================
  package org.apache.velocity.util;
  
  import java.lang.reflect.Method;
  
  public class Introspector
  {
      // How do I want to structure this? I only have to
      // do this once through parsing. Go through the
      // whole scenerio. Maps, Properties, Methods.
      
      // Even on the first pass, collect all the info
      // in a hash. Make a primitive hash first for
      // just the method name and the number of args.
      
      public static Method getMethod(Class c, String name, int params)
          throws Exception
      {
          Method[] methods = c.getMethods();
      
          for (int i = 0; i < methods.length; i++)
          {
              if (methods[i].getName().equals(name) &&
                  methods[i].getParameterTypes().length == params)
                  return methods[i];
          }            
      
          return null;
      }
  }
  
  
  

Reply via email to