|
It can be summarized in the following code that I
added. I though you might want to add it in :-)
/**
* This will allow you to call a specific function from the command line. * It uses reflection to make the call. It is useful for "learning" how to write * ECS pages etc. It is simple reflection and so it assumes that any * method you are calling has no parameters. * * TODO: make it so that you can call with parameters etc * * @param method This is the method that you want to make the call on. * @param ecs This is the ecs testbed instance to call on. */ private static void callMethod(String method, TestBed ecs){ try{ java.lang.reflect.Method meth = TestBed.class.getMethod(method, new Class[]{}); meth.invoke(ecs , new Class[]{}); } catch (Exception e){ e.printStackTrace(); } } You can then add this code to the main to make it
happen.
TestBed ecs = new TestBed();
if (args.length == 1)
{
callMethod(args[0], ecs); } ONE WORD OF WARNING. I didn't make this robust
(obviously) so...if you don't pass in the right method name it will simply print
a stacktrace and die :-(
If others want me to extend it I could ... but this
was all I needed ;-)
Mason
|
- ECS1.4 TestBed classes Mason Ham
- ECS1.4 TestBed classes Robert Burrell Donkin
- Re: ECS1.4 TestBed classes Stephan Nagy
- Re: ECS1.4 TestBed classes Robert Burrell Donkin
- Re: ECS1.4 TestBed classes Stephan Nagy
- [PATCH] Re: ECS1.4 TestBed cla... Robert Burrell Donkin
- Re: [PATCH] Re: ECS1.4 Tes... Robert Burrell Donkin
- Re: Here is a change that I made to the testbed... Robert Burrell Donkin
- Re: Here is a change that I made to the tes... Stephan Nagy
