com.h3c.of.lib.msg

## Class MutableBucket

- java.lang.Object
- - com.h3c.of.lib.OpenflowStructure
  - - com.h3c.of.lib.msg.Bucket
    - - com.h3c.of.lib.msg.MutableBucket

- All Implemented Interfaces:
    MutableObject, MutableStructure, Structure

      public class MutableBucket
      extends Bucket
      implements MutableStructure

  Mutable subclass of `Bucket`.

- - ### Field Summary

    - ### Fields inherited from class com.h3c.of.lib.OpenflowStructure

      `version`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MutableBucket(ProtocolVersion pv)` Constructs a mutable bucket.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `MutableBucket` | `addAction(Action action)` Adds the specified action to this bucket; Since 1.1.
    `OpenflowStructure` | `toImmutable()` Returns an immutable instance of this structure.
    `String` | `toString()`
    `MutableBucket` | `watchGroup(GroupId watchGroup)` Sets the watch group for this bucket; Since 1.1.
    `MutableBucket` | `watchPort(BigPortNumber watchPort)` Sets the watch port for this bucket; Since 1.1.
    `MutableBucket` | `weight(int weight)` Sets the weight (u16) for this bucket; Since 1.1.
    `boolean` | `writable()` Returns true if this mutable object is still writable.

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

      `getActions, getWatchGroup, getWatchPort, getWeight, toDebugString, toDebugString`

    - ### Methods inherited from class com.h3c.of.lib.OpenflowStructure

      `getVersion, hex, hex, validate`

    - ### 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.Structure

      `getVersion, toDebugString`

- - ### Constructor Detail

    - #### MutableBucket

          public MutableBucket(ProtocolVersion pv)

      Constructs a mutable bucket.
      Parameters:
        `pv` - the protocol version

  - ### Method Detail

    - #### toImmutable

          public OpenflowStructure toImmutable()

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

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

      Specified by:
        `toImmutable` in interface `MutableStructure`
      Returns:
        an immutable instance of this structure.

    - #### 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 `Bucket`

    - #### weight

          public MutableBucket weight(int weight)

      Sets the weight (u16) for this bucket; Since 1.1.
      Parameters:
        `weight` - the bucket weight
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `IllegalArgumentException` - if the weight is not u16

    - #### watchPort

          public MutableBucket watchPort(BigPortNumber watchPort)

      Sets the watch port for this bucket; Since 1.1.
      Parameters:
        `watchPort` - the watch port
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `NullPointerException` - if watchPort is null
        `IllegalArgumentException` - if the port number is invalid

    - #### watchGroup

          public MutableBucket watchGroup(GroupId watchGroup)

      Sets the watch group for this bucket; Since 1.1.
      Parameters:
        `watchGroup` - the watch group
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `NullPointerException` - if watchGroup is null

    - #### addAction

          public MutableBucket addAction(Action action)

      Adds the specified action to this bucket; Since 1.1.
      Parameters:
        `action` - the action to add
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `NullPointerException` - if action is null

Copyright © 2014. All Rights Reserved.