Java Reference
In-Depth Information
public
public class
class CrossRef
CrossRef extends
extends APIFormatter {
/** Simple main program, construct self, process each .ZIP file
* found in CLASSPATH or in argv.
*/
public
public static
static void
void main ( String [] argv ) throws
throws IOException {
CrossRef xref = new
new CrossRef ();
xref . doArgs ( argv );
}
/**
* Print the fields and methods of one class.
*/
protected
protected void
void doClass ( Class <?> c ) {
startClass ( c );
try
try {
Field [] fields = c . getDeclaredFields ();
Arrays . sort ( fields , new
new Comparator < Field >() {
public
public int
int compare ( Field o1 , Field o2 ) {
return
return o1 . getName (). compareTo ( o2 . getName ());
}
});
for
for ( int
int i = 0 ; i < fields . length ; i ++) {
Field field = ( Field ) fields [ i ];
iif (! Modifier . isPrivate ( field . getModifiers ()))
putField ( field , c );
// else System.err.println("private field ignored: " + field);
}
Method methods [] = c . getDeclaredMethods ();
Arrays . sort ( methods , new
new Comparator < Method >() {
public
public int
int compare ( Method o1 , Method o2 ) {
return
return o1 . getName (). compareTo ( o2 . getName ());
}
});
for
for ( int
int i = 0 ; i < methods . length ; i ++) {
iif (! Modifier . isPrivate ( methods [ i ]. getModifiers ()))
putMethod ( methods [ i ], c );
// else System.err.println("pvt: " + methods[i]);
}
} catch
catch ( Exception e ) {
e . printStackTrace ();
}
endClass ();
}
Search WWH ::




Custom Search