本文整理汇总了Java中net.sourceforge.stripes.controller.Interceptor.getClass方法的典型用法代码示例。如果您正苦于以下问题:Java Interceptor.getClass方法的具体用法?Java Interceptor.getClass怎么用?Java Interceptor.getClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sourceforge.stripes.controller.Interceptor
的用法示例。
在下文中一共展示了Interceptor.getClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addInterceptor
import net.sourceforge.stripes.controller.Interceptor; //导入方法依赖的package包/类
/**
* Adds the interceptor to the map, associating it with the {@link LifecycleStage}s indicated
* by the {@link Intercepts} annotation. If the interceptor implements
* {@link ConfigurableComponent}, then its init() method will be called.
*/
protected void addInterceptor(Map<LifecycleStage, Collection<Interceptor>> map,
Interceptor interceptor) {
Class<? extends Interceptor> type = interceptor.getClass();
Intercepts intercepts = type.getAnnotation(Intercepts.class);
if (intercepts == null) {
log.error("An interceptor of type ", type.getName(), " was configured ",
"but was not marked with an @Intercepts annotation. As a ",
"result it is not possible to determine at which ",
"lifecycle stages the interceptor should be applied. This ",
"interceptor will be ignored.");
return;
}
else {
log.debug("Configuring interceptor '", type.getSimpleName(),
"', for lifecycle stages: ", intercepts.value());
}
// call init() if the interceptor implements ConfigurableComponent
if (interceptor instanceof ConfigurableComponent) {
try {
((ConfigurableComponent) interceptor).init(this);
}
catch (Exception e) {
log.error("Error initializing interceptor of type " + type.getName(), e);
}
}
for (LifecycleStage stage : intercepts.value()) {
Collection<Interceptor> stack = map.get(stage);
if (stack == null) {
stack = new LinkedList<Interceptor>();
map.put(stage, stack);
}
stack.add(interceptor);
}
}