当前位置: 首页>>代码示例>>Java>>正文


Java Interceptor.getClass方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:43,代码来源:DefaultConfiguration.java


注:本文中的net.sourceforge.stripes.controller.Interceptor.getClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。