Skip to content

Latest commit

 

History

History
23 lines (22 loc) · 1.68 KB

README.md

File metadata and controls

23 lines (22 loc) · 1.68 KB

JavaReflection

This program will help you to reflect in any Java class including your own classes by using Reflection.

Usage

This program uses command options and argument to provide the user a mechanism to explore the internal structure of a class. the following options are used by this class: <br > -c: List all the constructors in the class <br > -m: List all the method in the class <br > -v: List all the variables in the class <br > -a: List all the information about the class <br > -C: List all the constants of the class <br > -i: List all the interfaces of the class <br > -h: List help about the options available <br >

Compilation

Either you can use the ReflectionTest program provided here as a test for the Reflection class, or you can make your own main program. <br > For this example we are using the provided ReflectionTest.java class for compilation and execution. Note: The whole project including Reflection.java, myUtilities package and GetOpt.class must be on the same directory where the compilation takes place. <br > You can compile this program in terminal by using this command: <br > javac ReflectionTest.java

Execution

For this example we are reflecting over the classes java.util.Date, but you can use any class made in Java including your own classes. The following command will output all the reflective facilities such as constructors, methods, variables. constants, interfaces as well as info about java.util.Date class. <br >

    java ReflectionTest -c -m -v -a -C -i -h java.util.Date