FileDocCategorySizeDatePackage
NestedInfoDemo.javaAPI DocExample2373Sun Dec 14 22:47:38 GMT 2003oreilly.hcj.reflection

NestedInfoDemo

public class NestedInfoDemo extends Object
Demonstrates fetching nested class info from a Class object.
author
Robert Simmons jr. (kraythe)
version
$Revision: 1.3 $

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)
Demo method.

param
args Command line arguments.

		printMemberClasses(BasicMonitorScreen.class);
		printMemberClasses(DoubleNestedClass.class);
		printMemberClasses(DoubleNestedClass.SomeClass.class);
		printMemberClasses(AnonymousDemo.class);
		printMemberClasses(Account.class);
		printMemberClasses(MethodInnerClassDemo.class);
		printMemberClasses(MutableObject.class);
	
public static voidprintMemberClasses(java.lang.Class dataType)
Printo out member information for a class.

param
dataType The class to work with.

		final Class[] nestedClasses = dataType.getClasses();
		final Class[] declaredNestedClasses = dataType.getDeclaredClasses();
		final Class[] nestedInterfaces = dataType.getInterfaces();
		final Class declaringClass = dataType.getDeclaringClass();

		// --
		System.out.println("Member Class infor for: " + dataType.getName());
		System.out.println("Nested Classes: " + Arrays.asList(nestedClasses));
		System.out.println("Declared Nested Classes: "
		                   + Arrays.asList(declaredNestedClasses));
		System.out.println("Interfaces: " + Arrays.asList(nestedInterfaces));
		System.out.println("Declaring Class: " + declaringClass);
		System.out.println();