home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Shareware / Comunicatii / advwebrank / awr.msi / disk1.cab / bsh_1.2b6.jar / bsh / commands / which.bsh < prev    next >
Encoding:
Text File  |  2002-05-24  |  628 b   |  25 lines

  1. /**
  2.     Use classpath mapping to determine the source of the specified class
  3.     file.  (Like the Unix which command for executables).
  4.  
  5.     @method which( classIdentifier | string | class )
  6. */
  7.  
  8. bsh.help.which= "usage: which( classIdentifier | string | class )";
  9.  
  10. import bsh.Name;
  11. import bsh.BshClassManager;
  12.  
  13. which( clas ) { 
  14.     // make the class into a name
  15.     if ( clas instanceof Name.ClassIdentifier )
  16.         clas = this.namespace.identifierToClass( clas );
  17.     if ( clas instanceof Class )
  18.         clas = clas.getName();
  19.     String className = clas;
  20.  
  21.     cp = BshClassManager.getClassManager().getClassPath();
  22.     print ( cp.getClassSource( className ) );
  23. }
  24.  
  25.