當前位置: 首頁>>代碼示例>>Java>>正文


Java EventMapping類代碼示例

本文整理匯總了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));
}
 
開發者ID:line,項目名稱:line-bot-sdk-java,代碼行數:18,代碼來源:LineMessageHandlerSupport.java

示例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();
}
 
開發者ID:line,項目名稱:line-bot-sdk-java,代碼行數:22,代碼來源:LineMessageHandlerSupport.java

示例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()));
            });
}
 
開發者ID:line,項目名稱:line-bot-sdk-java,代碼行數:19,代碼來源:KitchenSinkController.java

示例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));
            });
}
 
開發者ID:line,項目名稱:line-bot-sdk-java,代碼行數:17,代碼來源:KitchenSinkController.java

示例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);
}
 
開發者ID:axellageraldinc,項目名稱:lj-line-bot,代碼行數:12,代碼來源:MainController.java

示例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");
}
 
開發者ID:axellageraldinc,項目名稱:lj-line-bot,代碼行數:8,代碼來源:MainController.java

示例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);
}
 
開發者ID:axellageraldinc,項目名稱:lj-line-bot,代碼行數:15,代碼來源:MainController.java

示例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);
    }
}
 
開發者ID:axellageraldinc,項目名稱:lj-line-bot,代碼行數:13,代碼來源:MainController.java

示例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()
    ));
}
 
開發者ID:line,項目名稱:line-bot-sdk-java,代碼行數:11,代碼來源:KitchenSinkController.java

示例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));
            });
}
 
開發者ID:line,項目名稱:line-bot-sdk-java,代碼行數:11,代碼來源:KitchenSinkController.java

示例11: handleText

import com.linecorp.bot.spring.boot.annotation.EventMapping; //導入依賴的package包/類
@EventMapping
public void handleText(MessageEvent<TextMessageContent> msg) {
    handleContent(msg.getReplyToken(), msg, msg.getMessage());
}
 
開發者ID:axellageraldinc,項目名稱:lj-line-bot,代碼行數:5,代碼來源:MainController.java

示例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);
}
 
開發者ID:aytdm,項目名稱:garbage-reminder-bot,代碼行數:7,代碼來源:WebhookController.java

示例13: defaultMessageEvent

import com.linecorp.bot.spring.boot.annotation.EventMapping; //導入依賴的package包/類
@EventMapping
public void defaultMessageEvent(Event event) {
    log.info("event: " + event);
}
 
開發者ID:aytdm,項目名稱:garbage-reminder-bot,代碼行數:5,代碼來源:WebhookController.java

示例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 :)");
}
 
開發者ID:aytdm,項目名稱:garbage-reminder-bot,代碼行數:5,代碼來源:WebhookController.java

示例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");
}
 
開發者ID:aytdm,項目名稱:garbage-reminder-bot,代碼行數:5,代碼來源:WebhookController.java


注:本文中的com.linecorp.bot.spring.boot.annotation.EventMapping類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。