本文整理匯總了Java中com.linecorp.bot.spring.boot.annotation.EventMapping類的典型用法代碼示例。如果您正苦於以下問題:Java EventMapping類的具體用法?Java EventMapping怎麽用?Java EventMapping使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EventMapping類屬於com.linecorp.bot.spring.boot.annotation包,在下文中一共展示了EventMapping類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getMethodHandlerMethodFunction
import com.linecorp.bot.spring.boot.annotation.EventMapping; //導入依賴的package包/類
private HandlerMethod getMethodHandlerMethodFunction(Object consumer, Method method) {
final EventMapping mapping = AnnotatedElementUtils.getMergedAnnotation(method, EventMapping.class);
if (mapping == null) {
return null;
}
Preconditions.checkState(method.getParameterCount() == 1,
"Number of parameter should be 1. But {}",
(Object[]) method.getParameterTypes());
// TODO: Support more than 1 argument. Like MVC's argument resolver?
final Type type = method.getGenericParameterTypes()[0];
final Predicate<Event> predicate = new EventPredicate(type);
return new HandlerMethod(predicate, consumer, method,
getPriority(mapping, type));
}
示例2: getPriority
import com.linecorp.bot.spring.boot.annotation.EventMapping; //導入依賴的package包/類
private int getPriority(final EventMapping mapping, final Type type) {
if (mapping.priority() != EventMapping.DEFAULT_PRIORITY_VALUE) {
return mapping.priority();
}
if (type == Event.class) {
return EventMapping.DEFAULT_PRIORITY_FOR_EVENT_IFACE;
}
if (type instanceof Class) {
return ((Class<?>) type).isInterface()
? EventMapping.DEFAULT_PRIORITY_FOR_IFACE
: EventMapping.DEFAULT_PRIORITY_FOR_CLASS;
}
if (type instanceof ParameterizedType) {
return EventMapping.DEFAULT_PRIORITY_FOR_PARAMETRIZED_TYPE;
}
throw new IllegalStateException();
}
示例3: handleImageMessageEvent
import com.linecorp.bot.spring.boot.annotation.EventMapping; //導入依賴的package包/類
@EventMapping
public void handleImageMessageEvent(MessageEvent<ImageMessageContent> event) throws IOException {
// You need to install ImageMagick
handleHeavyContent(
event.getReplyToken(),
event.getMessage().getId(),
responseBody -> {
DownloadedContent jpg = saveContent("jpg", responseBody);
DownloadedContent previewImg = createTempFile("jpg");
system(
"convert",
"-resize", "240x",
jpg.path.toString(),
previewImg.path.toString());
reply(((MessageEvent) event).getReplyToken(),
new ImageMessage(jpg.getUri(), jpg.getUri()));
});
}
示例4: handleVideoMessageEvent
import com.linecorp.bot.spring.boot.annotation.EventMapping; //導入依賴的package包/類
@EventMapping
public void handleVideoMessageEvent(MessageEvent<VideoMessageContent> event) throws IOException {
// You need to install ffmpeg and ImageMagick.
handleHeavyContent(
event.getReplyToken(),
event.getMessage().getId(),
responseBody -> {
DownloadedContent mp4 = saveContent("mp4", responseBody);
DownloadedContent previewImg = createTempFile("jpg");
system("convert",
mp4.path + "[0]",
previewImg.path.toString());
reply(((MessageEvent) event).getReplyToken(),
new VideoMessage(mp4.getUri(), previewImg.uri));
});
}
示例5: handleJoinNewGroup
import com.linecorp.bot.spring.boot.annotation.EventMapping; //導入依賴的package包/類
@EventMapping
public void handleJoinNewGroup(JoinEvent joinEvent) {
List<Message> messageList = new ArrayList<>();
Source source = joinEvent.getSource();
StickerMessage stickerMessage = new StickerMessage("1", "2");
messageList.add(stickerMessage);
TextMessage textMessage = new TextMessage("Nuwun yo aku wes entuk join grup iki\n" +
"Silakan ketik /fitur untuk melihat fitur-fitur yang ada.");
messageList.add(textMessage);
KirimPesan(joinEvent.getReplyToken(), messageList);
}
示例6: handleLeave
import com.linecorp.bot.spring.boot.annotation.EventMapping; //導入依賴的package包/類
@EventMapping
public void handleLeave(LeaveEvent leaveEvent){
Source source = leaveEvent.getSource();
String groupId = getter.getId(source);
MainDao.DropTable(groupId);
MainDao.DropTable(groupId + "_memberIds");
}
示例7: handleNewFollower
import com.linecorp.bot.spring.boot.annotation.EventMapping; //導入依賴的package包/類
@EventMapping
public void handleNewFollower(FollowEvent followEvent){
List<Message> messageList = new ArrayList<>();
Source source = followEvent.getSource();
String id_umum = getter.getId(source);
MainDao.CreateTableData(id_umum);
StickerMessage stickerMessage = new StickerMessage("1", "2");
messageList.add(stickerMessage);
TextMessage textMessage = new TextMessage("Nuwun yo aku wes di-add dadi friend\n" +
"Silakan ketik /fitur untuk melihat fitur-fitur yang ada.\n" +
"Aku di invite ning group yo iso lhoooo");
messageList.add(textMessage);
KirimPesan(followEvent.getReplyToken(), messageList);
}
示例8: handleImage
import com.linecorp.bot.spring.boot.annotation.EventMapping; //導入依賴的package包/類
@EventMapping
public void handleImage(MessageEvent<ImageMessageContent> img){
String group_id = getter.getId(img.getSource());
if(MainDao.getStatus(group_id)==1){
ImageMessageContent imageMessageContent = img.getMessage();
String id_umum = imageMessageContent.getId();
FaceDetector faceDetector = new FaceDetector();
TextMessage textMessage = faceDetector.handleImageContent(id_umum);
KirimPesan(img.getReplyToken(), textMessage);
System.out.println("ID MESSAGE IMAGE : " + id_umum);
}
}
示例9: handleLocationMessageEvent
import com.linecorp.bot.spring.boot.annotation.EventMapping; //導入依賴的package包/類
@EventMapping
public void handleLocationMessageEvent(MessageEvent<LocationMessageContent> event) {
LocationMessageContent locationMessage = event.getMessage();
reply(event.getReplyToken(), new LocationMessage(
locationMessage.getTitle(),
locationMessage.getAddress(),
locationMessage.getLatitude(),
locationMessage.getLongitude()
));
}
示例10: handleAudioMessageEvent
import com.linecorp.bot.spring.boot.annotation.EventMapping; //導入依賴的package包/類
@EventMapping
public void handleAudioMessageEvent(MessageEvent<AudioMessageContent> event) throws IOException {
handleHeavyContent(
event.getReplyToken(),
event.getMessage().getId(),
responseBody -> {
DownloadedContent mp4 = saveContent("mp4", responseBody);
reply(event.getReplyToken(), new AudioMessage(mp4.getUri(), 100));
});
}
示例11: handleText
import com.linecorp.bot.spring.boot.annotation.EventMapping; //導入依賴的package包/類
@EventMapping
public void handleText(MessageEvent<TextMessageContent> msg) {
handleContent(msg.getReplyToken(), msg, msg.getMessage());
}
示例12: handleTextMessageEvent
import com.linecorp.bot.spring.boot.annotation.EventMapping; //導入依賴的package包/類
@EventMapping
public void handleTextMessageEvent(MessageEvent<TextMessageContent> event) throws Exception {
log.info("event: {}", event);
TextMessageContent message = event.getMessage();
webhookService.handleTextContent(event.getReplyToken(), event, message);
}
示例13: defaultMessageEvent
import com.linecorp.bot.spring.boot.annotation.EventMapping; //導入依賴的package包/類
@EventMapping
public void defaultMessageEvent(Event event) {
log.info("event: " + event);
}
示例14: handleStickerMessage
import com.linecorp.bot.spring.boot.annotation.EventMapping; //導入依賴的package包/類
@EventMapping
public Message handleStickerMessage(MessageEvent<StickerMessageContent> event) {
return new TextMessage("Thank you for sending stamp :)");
}
示例15: handleImageMessage
import com.linecorp.bot.spring.boot.annotation.EventMapping; //導入依賴的package包/類
@EventMapping
public Message handleImageMessage(MessageEvent<ImageMessageContent> event) {
return new TextMessage("Thank you for sending image :D");
}