com.h3c.util.net.msg

## Class Conversation

- java.lang.Object
- - com.h3c.util.net.msg.Conversation

- Direct Known Subclasses:
    Echo, QueuedConversation, RequestResponseConversation, SendOnlyConversation

      public abstract class Conversation
      extends Object

  Abstraction of a topic-aware but otherwise opaque conversation context.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Conversation(String topic, int id, int parentId)` Create a new conversation with the supplied id and topic.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `acceptMessage(byte[] message)` Accept a byte form of a message in the context of a given conversation.
    `Connection` | `connection()` Get the connection with which this conversation is associated.
    `boolean` | `equals(Object o)` Equality is based on ID
    `int` | `hashCode()` Hash code is based on ID
    `int` | `id()` Get the unique ID of the conversation.
    `boolean` | `isEnded()` Gives indication whether the conversation is ongoing or has been ended.
    `int` | `parentId()` Get the unique ID of the parent conversation.
    `protected void` | `setConnection(Connection connection)` Associate this conversation with the given connection.
    `String` | `topic()` Get the topic on behalf of which the conversation was created.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Conversation

          protected Conversation(String topic,
                      int id,
                      int parentId)

      Create a new conversation with the supplied id and topic.
      Parameters:
        `topic` - conversation topic
        `id` - unique conversation id
        `parentId` - unique conversation id of the parent conversation; 0 if no parent conversation

  - ### Method Detail

    - #### topic

          public String topic()

      Get the topic on behalf of which the conversation was created.
      Returns:
        topic name

    - #### id

          public int id()

      Get the unique ID of the conversation.
      Returns:
        conversation id

    - #### parentId

          public int parentId()

      Get the unique ID of the parent conversation.
      Returns:
        parent conversation id

    - #### connection

          public Connection connection()

      Get the connection with which this conversation is associated.
      Returns:
        conversation with which this connection is associated.

    - #### setConnection

          protected void setConnection(Connection connection)

      Associate this conversation with the given connection.
      Parameters:
        `connection` - connection with which this conversation is to be associated

    - #### isEnded

          public boolean isEnded()

      Gives indication whether the conversation is ongoing or has been ended.
      Returns:
        true if the conversation has been ended; false if ongoing

    - #### acceptMessage

          public abstract void acceptMessage(byte[] message)

      Accept a byte form of a message in the context of a given conversation.
      Parameters:
        `message` - byte buffer containing the raw message

    - #### equals

          public boolean equals(Object o)

      Equality is based on ID
      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Hash code is based on ID
      Overrides:
        `hashCode` in class `Object`

Copyright © 2014. All Rights Reserved.