source: trunk/j/src/bsh/commands/javap.bsh @ 2

Last change on this file since 2 was 2, checked in by piso, 18 years ago

Initial checkin.

File size: 833 bytes
Line 
1
2bsh.help.javap= "usage: javap( value )";
3
4import bsh.Name;
5javap( Object o )
6{
7  import java.lang.reflect.Modifier;
8
9  if ( o instanceof Name.ClassIdentifier )
10    clas = this.namespace.identifierToClass(o);
11  if ( o instanceof String)
12    clas = this.namespace.getClass((String)o);
13  else if ( o instanceof Class )
14    clas = o;
15  else
16    clas = o.getClass();
17 
18  print( "Class "+clas+" extends " +clas.getSuperclass() );
19
20  methods=clas.getDeclaredMethods();
21  //print("------------- Methods ----------------");
22  for(int i=0; i<methods.length; i++) {
23    m = methods[i];
24    if ( Modifier.isPublic( m.getModifiers() ) )
25      print( m );
26  }
27
28  //print("------------- Fields ----------------");
29  fields=clas.getDeclaredFields();
30  for(int i=0; i<fields.length; i++) {
31    f = fields[i];
32    if ( Modifier.isPublic( f.getModifiers() ) )
33      print( f );
34  }
35}
36
Note: See TracBrowser for help on using the repository browser.