本文整理匯總了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));
}