src/main/java/org/jboss/util/Classes.java
public static void displayClassInfo(Class clazz, StringBuffer results)
   {
      // Print out some codebase info for the clazz
      ClassLoader cl = clazz.getClassLoader();
      results.append("\n");
      results.append(clazz.getName());
      results.append("(");
      results.append(Integer.toHexString(clazz.hashCode()));
      results.append(").ClassLoader=");
      results.append(cl);
      ClassLoader parent = cl;
      while( parent != null )
      {
         results.append("\n..");
         results.append(parent);
         URL[] urls = getClassLoaderURLs(parent);
         int length = urls != null ? urls.length : 0;
         for(int u = 0; u < length; u ++)
         {
            results.append("\n....");
            results.append(urls[u]);
         }
         if( parent != null )
            parent = parent.getParent();
      }
      CodeSource clazzCS = clazz.getProtectionDomain().getCodeSource();
      if( clazzCS != null )
      {
         results.append("\n++++CodeSource: ");
         results.append(clazzCS);
      }
      else
         results.append("\n++++Null CodeSource");

      results.append("\nImplemented Interfaces:");
      Class[] ifaces = clazz.getInterfaces();
      for(int i = 0; i < ifaces.length; i ++)
      {
         Class iface = ifaces[i];
         results.append("\n++");
         results.append(iface);
         results.append("(");
         results.append(Integer.toHexString(iface.hashCode()));
         results.append(")");
         ClassLoader loader = ifaces[i].getClassLoader();
         results.append("\n++++ClassLoader: ");
         results.append(loader);
         ProtectionDomain pd = ifaces[i].getProtectionDomain();
         CodeSource cs = pd.getCodeSource();
         if( cs != null )
         {
            results.append("\n++++CodeSource: ");
            results.append(cs);
         }
         else
            results.append("\n++++Null CodeSource");
      }
   }
public static void displayClassInfo(Class clazz, StringBuffer results)
   {
      // Print out some codebase info for the clazz
      ClassLoader cl = clazz.getClassLoader();
      results.append("\n");
      results.append(clazz.getName());
      results.append("(");
      results.append(Integer.toHexString(clazz.hashCode()));
      results.append(").ClassLoader=");
      results.append(cl);
      ClassLoader parent = cl;
      while( parent != null )
      {
         results.append("\n..");
         results.append(parent);
         URL[] urls = getClassLoaderURLs(parent);
         int length = urls != null ? urls.length : 0;
         for(int u = 0; u < length; u ++)
         {
            results.append("\n....");
            results.append(urls[u]);
         }
         if( parent != null )
            parent = parent.getParent();
      }
      CodeSource clazzCS = clazz.getProtectionDomain().getCodeSource();
      if( clazzCS != null )
      {
         results.append("\n++++CodeSource: ");
         results.append(clazzCS);
      }
      else
         results.append("\n++++Null CodeSource");

      results.append("\nImplemented Interfaces:");
      Class[] ifaces = clazz.getInterfaces();
      for(int i = 0; i < ifaces.length; i ++)
      {
         Class iface = ifaces[i];
         results.append("\n++");
         results.append(iface);
         results.append("(");
         results.append(Integer.toHexString(iface.hashCode()));
         results.append(")");
         ClassLoader loader = ifaces[i].getClassLoader();
         results.append("\n++++ClassLoader: ");
         results.append(loader);
         ProtectionDomain pd = ifaces[i].getProtectionDomain();
         CodeSource cs = pd.getCodeSource();
         if( cs != null )
         {
            results.append("\n++++CodeSource: ");
            results.append(cs);
         }
         else
            results.append("\n++++Null CodeSource");
      }
   }
public static void displayClassInfo ( Class clazz , StringBuffer results ) { // Print out some codebase info for the clazz ClassLoader cl = clazz . getClassLoader ( ) ; results . append ( "\n" ) ; results . append ( clazz . getName ( ) ) ; results . append ( "(" ) ; results . append ( Integer . toHexString ( clazz . hashCode ( ) ) ) ; results . append ( ").ClassLoader=" ) ; results . append ( cl ) ; ClassLoader parent = cl ; while ( parent != null ) { results . append ( "\n.." ) ; results . append ( parent ) ; URL [ ] urls = getClassLoaderURLs ( parent ) ; int length = urls != null ? urls . length : 0 ; for ( int u = 0 ; u < length ; u ++ ) { results . append ( "\n...." ) ; results . append ( urls [ u ] ) ; } if ( parent != null ) parent = parent . getParent ( ) ; } CodeSource clazzCS = clazz . getProtectionDomain ( ) . getCodeSource ( ) ; if ( clazzCS != null ) { results . append ( "\n++++CodeSource: " ) ; results . append ( clazzCS ) ; } else results . append ( "\n++++Null CodeSource" ) ; results . append ( "\nImplemented Interfaces:" ) ; Class [ ] ifaces = clazz . getInterfaces ( ) ; for ( int i = 0 ; i < ifaces . length ; i ++ ) { Class iface = ifaces [ i ] ; results . append ( "\n++" ) ; results . append ( iface ) ; results . append ( "(" ) ; results . append ( Integer . toHexString ( iface . hashCode ( ) ) ) ; results . append ( ")" ) ; ClassLoader loader = ifaces [ i ] . getClassLoader ( ) ; results . append ( "\n++++ClassLoader: " ) ; results . append ( loader ) ; ProtectionDomain pd = ifaces [ i ] . getProtectionDomain ( ) ; CodeSource cs = pd . getCodeSource ( ) ; if ( cs != null ) { results . append ( "\n++++CodeSource: " ) ; results . append ( cs ) ; } else results . append ( "\n++++Null CodeSource" ) ; } }
Format a string buffer containing the Class, Interfaces, CodeSource,
and ClassLoader information for the given object clazz.

@param clazz the Class
@param results - the buffer to write the info to
Format a string buffer containing the Class Interfaces CodeSource and ClassLoader information for the given object clazz .