com.h3c.of.lib.msg

## Class OfmMutableError

- java.lang.Object
- - com.h3c.nbio.AbstractMessage
  - - com.h3c.of.lib.msg.OpenflowMessage
    - - com.h3c.of.lib.msg.OfmError
      - - com.h3c.of.lib.msg.OfmMutableError

- All Implemented Interfaces:
    Message, MutableMessage, MutableObject, Structure

      public class OfmMutableError
      extends OfmError
      implements MutableMessage

  Mutable subclass of `OfmError`.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.h3c.of.lib.msg.OpenflowMessage

      `OpenflowMessage.Header`

  - ### Field Summary

    - ### Fields inherited from class com.h3c.nbio.AbstractMessage

      `length`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearXid()` Clears the transaction ID field of this message (sets it to 0).
    `OfmMutableError` | `errorCode(ErrorCode code)` Sets the error code; Since 1.0.
    `OfmMutableError` | `errorMessage(String msg)` Sets the error message; Since 1.0.
    `OfmMutableError` | `errorType(ErrorType type)` Sets the error type; Since 1.0.
    `OfmMutableError` | `setData(byte[] data)` Sets the associated data; Since 1.0.
    `OpenflowMessage` | `toImmutable()` Returns an immutable instance of this message.
    `String` | `toString()`
    `boolean` | `writable()` Returns true if this mutable object is still writable.

    - ### Methods inherited from class com.h3c.of.lib.msg.OfmError

      `getData, getErrorCode, getErrorMessage, getErrorType, toDebugString, validate`

    - ### Methods inherited from class com.h3c.of.lib.msg.OpenflowMessage

      `decodeHeader, getType, getVersion, getXid, hex, hex, length`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.h3c.of.lib.msg.Message

      `getType, getXid`

    - ### Methods inherited from interface com.h3c.of.lib.Structure

      `getVersion, toDebugString`

- - ### Method Detail

    - #### clearXid

          public void clearXid()

      Description copied from interface: `MutableMessage`
      Clears the transaction ID field of this message (sets it to 0).
      Specified by:
        `clearXid` in interface `MutableMessage`

    - #### toImmutable

          public OpenflowMessage toImmutable()

      Description copied from interface: `MutableMessage`
      Returns an immutable instance of this message. In essence, converts this message to be read-only.

      It is expected that the reference to this mutable message will be dropped. Note that all method calls invoked on a `MutableMessage` after `toImmutable()` has been invoked will result in an `InvalidMutableException` being thrown.

      Specified by:
        `toImmutable` in interface `MutableMessage`
      Returns:
        an immutable instance of this message.

    - #### writable

          public boolean writable()

      Description copied from interface: `MutableObject`
      Returns true if this mutable object is still writable. That is, the `#toImmutable()` method (defined on a sub-interface) has not yet been invoked.
      Specified by:
        `writable` in interface `MutableObject`
      Returns:
        true if this mutable object is still writable

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `OfmError`

    - #### errorType

          public OfmMutableError errorType(ErrorType type)

      Sets the error type; Since 1.0.
      Parameters:
        `type` - the error type
      Returns:
        self, for chaining
      Throws:
        `NullPointerException` - if type is null
        `InvalidMutableException` - if this instance is no longer writable

    - #### errorCode

          public OfmMutableError errorCode(ErrorCode code)

      Sets the error code; Since 1.0. Note that the error type must have been set already, or an `IllegalStateException` will be thrown.
      Parameters:
        `code` - the error code
      Returns:
        self, for chaining
      Throws:
        `NullPointerException` - if type is null
        `InvalidMutableException` - if this instance is no longer writable
        `IllegalArgumentException` - if code is not appropriate for the type
        `IllegalStateException` - if the type has not been set yet

    - #### setData

          public OfmMutableError setData(byte[] data)

      Sets the associated data; Since 1.0. Note that the error type must have been set already, or an `IllegalStateException` will be thrown. If the error type is `HELLO_FAILED`, use `errorMessage(java.lang.String)` instead.
      Parameters:
        `data` - the data
      Returns:
        self, for chaining
      Throws:
        `NullPointerException` - if data is null
        `InvalidMutableException` - if this instance is no longer writable
        `IllegalStateException` - if the type has not been set or if it is HELLO_FAILED

    - #### errorMessage

          public OfmMutableError errorMessage(String msg)

      Sets the error message; Since 1.0. Note that this is only appropriate if the error type has already been set to `HELLO_FAILED`. The message is encoded as ASCII in the data field.
      Parameters:
        `msg` - the error message to set
      Returns:
        self, for chaining
      Throws:
        `NullPointerException` - if data is null
        `InvalidMutableException` - if this instance is no longer writable
        `IllegalStateException` - if the type is not HELLO_FAILED

Copyright © 2014. All Rights Reserved.