SessionAttributesHandler.java 文件源码

java
阅读 56 收藏 0 点赞 0 评论 0

项目:lams 作者:
/**
 * Create a new instance for a controller type. Session attribute names and
 * types are extracted from the {@code @SessionAttributes} annotation, if
 * present, on the given type.
 * @param handlerType the controller type
 * @param sessionAttributeStore used for session access
 */
public SessionAttributesHandler(Class<?> handlerType, SessionAttributeStore sessionAttributeStore) {
    Assert.notNull(sessionAttributeStore, "SessionAttributeStore may not be null.");
    this.sessionAttributeStore = sessionAttributeStore;

    SessionAttributes annotation = AnnotationUtils.findAnnotation(handlerType, SessionAttributes.class);
    if (annotation != null) {
        this.attributeNames.addAll(Arrays.asList(annotation.value()));
        this.attributeTypes.addAll(Arrays.<Class<?>>asList(annotation.types()));
    }

    for (String attributeName : this.attributeNames) {
        this.knownAttributeNames.add(attributeName);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号