Example usage for org.springframework.core MethodParameter hasMethodAnnotation

List of usage examples for org.springframework.core MethodParameter hasMethodAnnotation

Introduction

In this page you can find the example usage for org.springframework.core MethodParameter hasMethodAnnotation.

Prototype

public <A extends Annotation> boolean hasMethodAnnotation(Class<A> annotationType) 

Source Link

Document

Return whether the method/constructor is annotated with the given type.

Usage

From source file:org.springframework.messaging.simp.annotation.support.SubscriptionMethodReturnValueHandler.java

@Override
public boolean supportsReturnType(MethodParameter returnType) {
    return (returnType.hasMethodAnnotation(SubscribeMapping.class)
            && !returnType.hasMethodAnnotation(SendTo.class)
            && !returnType.hasMethodAnnotation(SendToUser.class));
}

From source file:org.springframework.web.method.annotation.ModelAttributeMethodProcessor.java

/**
 * Return {@code true} if there is a method-level {@code @ModelAttribute}
 * or, in default resolution mode, for any return value type that is not
 * a simple type./* w ww .  j  a  va  2s  . com*/
 */
@Override
public boolean supportsReturnType(MethodParameter returnType) {
    return (returnType.hasMethodAnnotation(ModelAttribute.class)
            || (this.annotationNotRequired && !BeanUtils.isSimpleProperty(returnType.getParameterType())));
}