本文整理汇总了Java中org.springframework.core.MethodParameter.hasMethodAnnotation方法的典型用法代码示例。如果您正苦于以下问题:Java MethodParameter.hasMethodAnnotation方法的具体用法?Java MethodParameter.hasMethodAnnotation怎么用?Java MethodParameter.hasMethodAnnotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.core.MethodParameter
的用法示例。
在下文中一共展示了MethodParameter.hasMethodAnnotation方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: supportsReturnType
import org.springframework.core.MethodParameter; //导入方法依赖的package包/类
/**
* 有WxAsyncMessage注解且
* 返回值是WxMessage的子类
* 或者是CharSequence的子类,且有注解WxButton或者WXMessageMapping
*
* @param returnType
* @return dummy
*/
@Override
public boolean supportsReturnType(MethodParameter returnType) {
// 如果是iterable或者array,都作为asyncMessage消息处理
boolean isIterableType = Iterable.class.isAssignableFrom(returnType.getParameterType());
boolean isArrayType = returnType.getParameterType().isArray();
boolean isGroupMessage = WxGroupMessage.class.isAssignableFrom(returnType.getParameterType());
boolean isTemplateMessage = WxTemplateMessage.class.isAssignableFrom(returnType.getParameterType());
// 理论上WxAsyncMessage已经被上层处理过了,这里保险起见再处理一次
boolean needAsyncSend = isIterableType || isArrayType || isGroupMessage || isTemplateMessage;
Class realType = getGenericType(returnType);
boolean isWxMessage = WxMessage.class.isAssignableFrom(realType);
boolean isWxStringMessage = CharSequence.class.isAssignableFrom(realType) &&
returnType.hasMethodAnnotation(WxMapping.class);
return needAsyncSend && (isWxMessage || isWxStringMessage);
}
示例2: supportsReturnType
import org.springframework.core.MethodParameter; //导入方法依赖的package包/类
@Override
public boolean supportsReturnType(MethodParameter returnType) {
return returnType.hasMethodAnnotation(ExcelFile.class) &&
(Workbook.class.isAssignableFrom(returnType.getMethod().getReturnType()) ||
InputStream.class.isAssignableFrom(returnType.getMethod().getReturnType())
);
}
示例3: supports
import org.springframework.core.MethodParameter; //导入方法依赖的package包/类
@Override
public boolean supports(MethodParameter returnType,
Class<? extends HttpMessageConverter<?>> converterType) {
return StringHttpMessageConverter.class.isAssignableFrom(converterType) &&
CharSequence.class.isAssignableFrom(returnType.getParameterType()) &&
returnType.hasMethodAnnotation(WxMapping.class);
}
示例4: supports
import org.springframework.core.MethodParameter; //导入方法依赖的package包/类
public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
return FastJsonHttpMessageConverter.class.isAssignableFrom(converterType) && returnType.hasMethodAnnotation(FastJsonView.class);
}
示例5: supportsReturnType
import org.springframework.core.MethodParameter; //导入方法依赖的package包/类
@Override
public boolean supportsReturnType(MethodParameter returnType) {
return returnType.hasMethodAnnotation(ExcelResponseBody.class);
}
示例6: supports
import org.springframework.core.MethodParameter; //导入方法依赖的package包/类
public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
return FastJsonHttpMessageConverter.class.isAssignableFrom(converterType)
&&
(returnType.getContainingClass().isAnnotationPresent(ResponseJSONP.class) || returnType.hasMethodAnnotation(ResponseJSONP.class));
}