BOPF的这些determination,其方法不须要application developer本身去调用,而是被BOPF框架经过调用interface method的方式被调用。
Spring MVC的@RequestMapping工做原理相似,但实现方式稍稍高级点,用的是Java的反射。app
ProductPageController这个类的productDetail方法加上了@RequestMapping, 参数是:框架
当我点了product list上某个product的image想进入detail page时:url
这个包含了p的url就会被Spring MVCdelegate到我经过@RequestMapping注册的controller class上。从debugger里能看出个人controller class已经被成功地determine出来了。因此从本质上讲,@RequestMapping和在ABAP里经常使用的把CLAS名字配到表里的方法其目的都同样:注册,只是Annotation更加优雅和简便一点而已。spa
扫描原理见我博客:
A simulation of Java Spring dependency injection annotation @Inject in ABAP.
How does component-scan work in Spring Framework
How does @Autowired work in Spring framework
要执行的方法名字在这:debug
最后这个方法经过反射在line 497行被调用。3d
注意在Java里,每一个类的每一个方法的元数据均可以被sun.reflect.MethodAccessor的一个实例来描述,而ABAP里反射的granularity只到Class level,只有CL_ABAP_CLASSDESCR,没有CL_ABAP_CLASS_METHODDESCR!component
要获取更多Jerry的原创文章,请关注公众号"汪子熙":blog