Class DisconnectedEvent

  • All Implemented Interfaces:
    IEvent

    public final class DisconnectedEvent
    extends Object
    Event occurring when bot gets disconnected from server.
    • Constructor Summary

      Constructors 
      Constructor Description
      DisconnectedEvent​(URI serverUri, boolean remote, Integer statusCode, String reason)
      Initializes a new instance of the DisconnectedEvent class.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Optional<String> getReason()
      Returns a message with the reason for closing the connection, if such reason exists.
      URI getServerUri()
      Return the URI of the server.
      Optional<Integer> getStatusCode()
      Returns a status code that indicates the reason for closing the connection, if such status code exists.
      boolean isRemote()
      Checks if closing the connection was initiated by the remote host.
      • Methods inherited from class Object

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

      • DisconnectedEvent

        public DisconnectedEvent​(URI serverUri,
                                 boolean remote,
                                 Integer statusCode,
                                 String reason)
        Initializes a new instance of the DisconnectedEvent class.
        Parameters:
        serverUri - is the URI of the server.
        remote - is a flag indicating if closing of the connection was initiated by the remote host.
        statusCode - is a status code that indicates the reason for closing the connection.
        reason - is a message with the reason for closing the connection.
    • Method Detail

      • isRemote

        public boolean isRemote()
        Checks if closing the connection was initiated by the remote host.
        Returns:
        true if closing the connection was initiated by the remote host; false otherwise.
      • getStatusCode

        public Optional<Integer> getStatusCode()
        Returns a status code that indicates the reason for closing the connection, if such status code exists.
        Returns:
        a status code that indicates the reason for closing the connection, if such status code exists.
      • getReason

        public Optional<String> getReason()
        Returns a message with the reason for closing the connection, if such reason exists.
        Returns:
        a message with the reason for closing the connection, if such reason exists.
      • getServerUri

        public URI getServerUri()
        Return the URI of the server.
        Returns:
        the URI of the server.