jakarta-bcel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From en...@apache.org
Subject cvs commit: jakarta-bcel/src/java/org/apache/bcel/generic Type.java
Date Thu, 18 Dec 2003 19:40:33 GMT
enver       2003/12/18 11:40:33

  Modified:    src/java/org/apache/bcel/generic Type.java
  Log:
  Added a convenience method to convert a java.lang.Class[] to
  a Type[] because java.lang.Class.getInterfaces() or
  java.lang.reflect.Method.getParameterTypes() are so common cases
  where you have an array of Class in your hands.
  
  Revision  Changes    Path
  1.11      +14 -1     jakarta-bcel/src/java/org/apache/bcel/generic/Type.java
  
  Index: Type.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/generic/Type.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Type.java	24 Jul 2003 14:14:47 -0000	1.10
  +++ Type.java	18 Dec 2003 19:40:33 -0000	1.11
  @@ -291,6 +291,19 @@
       }
     }
   
  +  /**
  +   * Convert runtime java.lang.Class[] to BCEL Type objects.
  +   * @param classes an array of runtime class objects
  +   * @return array of corresponding Type objects
  +   */
  +  public static Type[] getTypes(java.lang.Class[] classes){
  +      Type[] ret = new Type[classes.length];
  +      for (int i = 0; i < ret.length; i++) {
  +          ret[i] = getType(classes[i]);
  +      }
  +      return ret;
  +  }
  +
     public static String getSignature(java.lang.reflect.Method meth) {
       StringBuffer sb = new StringBuffer("(");
       Class[] params = meth.getParameterTypes(); // avoid clone
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org


Mime
View raw message