Class PacketHandler

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected DiscordApiImpl api  
    • Constructor Summary

      Constructors 
      Constructor Description
      PacketHandler​(DiscordApi api, boolean async, java.lang.String type)
      Creates a new instance of this class.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.lang.String getType()
      Gets the type of packet the handler handles.
      protected abstract void handle​(com.fasterxml.jackson.databind.JsonNode packet)
      This method is called by the super class to handle the packet.
      void handlePacket​(com.fasterxml.jackson.databind.JsonNode packet)
      Handles the packet.
      int hashCode()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PacketHandler

        public PacketHandler​(DiscordApi api,
                             boolean async,
                             java.lang.String type)
        Creates a new instance of this class.
        Parameters:
        api - The api.
        async - Whether the packet should be handled in a new thread or in the websocket thread.
        type - The type of packet the class handles.
    • Method Detail

      • handlePacket

        public void handlePacket​(com.fasterxml.jackson.databind.JsonNode packet)
        Handles the packet.
        Parameters:
        packet - The packet (the "d"-object).
      • handle

        protected abstract void handle​(com.fasterxml.jackson.databind.JsonNode packet)
        This method is called by the super class to handle the packet.
        Parameters:
        packet - The packet (the "d"-object).
      • getType

        public java.lang.String getType()
        Gets the type of packet the handler handles.
        Returns:
        The type of the packet.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object