I also wrote a similar timing test program for creating objects using reflection. The differences for this case aren't nearly as significant as for the field and method call cases, though.
我还为创建使用反射的对象编写了类似的计时测试程序,但这种情况下的差异不象字段和方法调用情况下那么显著。
Listing 3 shows an example of using the field reflection methods, in the form of a method to increment an int field of an object by name.
清单3显示使用字段反射方法的一个实例,以方法的格式根据名称增加对象的int字段。
After you create and run the kernel, invoking a method on a POJO service simply becomes an exercise in using the Geronimo kernel server and its reflection capabilities, as shown in Listing 4.
创建并运行内核后,调用POJO服务上的方法就变成了练习使用Geronimo内核服务器及其反射功能,如清单4所示。
应用推荐