Example usage for org.springframework.core.type MethodMetadata isAnnotated

List of usage examples for org.springframework.core.type MethodMetadata isAnnotated

Introduction

In this page you can find the example usage for org.springframework.core.type MethodMetadata isAnnotated.

Prototype

default boolean isAnnotated(String annotationName) 

Source Link

Document

Determine whether the underlying element has an annotation or meta-annotation of the given type defined.

Usage

From source file:org.joinfaces.annotations.JsfCdiToSpring.java

static String deduceScopeName(MethodMetadata methodMetadata) {
    String result = null;/*from ww  w  . ja v a2 s.co m*/
    if (methodMetadata != null) {
        if (methodMetadata.isAnnotated(javax.enterprise.context.RequestScoped.class.getName())
                || methodMetadata.isAnnotated(javax.faces.bean.RequestScoped.class.getName())) {
            result = REQUEST;
        } else if (methodMetadata.isAnnotated(javax.enterprise.context.SessionScoped.class.getName())
                || methodMetadata.isAnnotated(javax.faces.bean.SessionScoped.class.getName())) {
            result = SESSION;
        } else if (methodMetadata.isAnnotated(javax.enterprise.context.ApplicationScoped.class.getName())
                || methodMetadata.isAnnotated(javax.faces.bean.ApplicationScoped.class.getName())) {
            result = SINGLETON;
        } else if (methodMetadata.isAnnotated(javax.faces.bean.NoneScoped.class.getName())) {
            result = PROTOTYPE;
        } else if (methodMetadata.isAnnotated(javax.faces.view.ViewScoped.class.getName())
                || methodMetadata.isAnnotated(javax.faces.bean.ViewScoped.class.getName())) {
            result = VIEW;
        } else if (methodMetadata.isAnnotated(javax.enterprise.context.ConversationScoped.class.getName())) {
            result = SESSION;
        }
    }

    return result;

}