[jboss-cvs] jbossretro/src/main/org/jboss/lang ...

Kabir Khan kkhan at jboss.com
Mon Jul 17 04:38:12 EDT 2006


  User: kkhan   
  Date: 06/07/17 04:38:12

  Modified:    src/main/org/jboss/lang  ClassRedirects.java
  Log:
  Redirect Class.isAnnotation()
  
  Revision  Changes    Path
  1.7       +33 -1     jbossretro/src/main/org/jboss/lang/ClassRedirects.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ClassRedirects.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbossretro/src/main/org/jboss/lang/ClassRedirects.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- ClassRedirects.java	29 Mar 2006 22:27:05 -0000	1.6
  +++ ClassRedirects.java	17 Jul 2006 08:38:12 -0000	1.7
  @@ -35,7 +35,7 @@
    *
    * @author <a href="adrian at jboss.com">Adrian Brock</a>
    * @author Scott.Stark at jboss.org
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    */
   public class ClassRedirects
   {
  @@ -46,6 +46,38 @@
       */
      private static final int SYNTHETIC = 0x00001000;
   
  +   
  +   /**
  +    * Whether the class is an annotation
  +    *
  +    * @param clazz the class
  +    * @return true when it is an annotation
  +    */
  +   public static boolean isAnnotation(Class clazz)
  +   {
  +      System.out.println(clazz.getSuperclass());
  +      Class[] interfaces = clazz.getInterfaces();
  +      System.out.println("interfaces " + interfaces.length);
  +
  +      for (int i = 0 ; i < interfaces.length ; i++)
  +      {
  +         System.out.println("interface " + interfaces[i]);
  +         if (interfaces[i].getName().equals("java.lang.Annotation"))
  +         {
  +            return true;
  +         }
  +         if (interfaces[i].getName().equals("org.jboss.lang.Annotation"))
  +         {
  +            return true;
  +         }
  +         if (isAnnotation(interfaces[i]))
  +         {
  +            return true;
  +         }
  +      }
  +      return false;
  +   }
  +
      /**
       * Whether the class is an enum
       *
  
  
  



More information about the jboss-cvs-commits mailing list