com.h3c.of.lib.dt

## Class TableId

- java.lang.Object
- - com.h3c.util.cache.CacheableDataType
  - - com.h3c.util.ip.UnsignedId
    - - com.h3c.util.ip.UnsignedIntBasedId
      - - com.h3c.util.ip.U8Id
        - - com.h3c.of.lib.dt.TableId

- All Implemented Interfaces:
    Serializable, Comparable<TableId>

      public final class TableId
      extends U8Id
      implements Comparable<TableId>

  Represents a table identifier (unsigned 8-bit); Since 1.0. Table IDs start at 0 and run through `MAX`.

  All constructors for this class are private. Creating instances of `TableId` is done via the static methods on the class.

  Instances of this class are immutable, making them inherently threadsafe.

  This class overrides `UnsignedIntBasedId.equals(java.lang.Object)` and `UnsignedIntBasedId.hashCode()` so that instances play nicely with the Collection classes.

  This class implements the `Comparable` interface to ensure that a sorted list of table IDs is presented in an intuitive order.

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static TableId` | `ALL` Denotes all tables.
    `static TableId` | `MAX` Denotes the last usable table id number.

    - ### Fields inherited from class com.h3c.util.ip.U8Id

      `MAX_VALUE`

    - ### Fields inherited from class com.h3c.util.ip.UnsignedIntBasedId

      `id`

    - ### Fields inherited from class com.h3c.util.ip.UnsignedId

      `E_BAD, E_NULL_BYTES, E_NULL_STR, E_OOR, MIN_VALUE`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(TableId o)` Implements the Comparable interface, to return table ids in natural order.
    `String` | `toString()` Returns a string representation of this id.
    `static TableId` | `valueOf(byte b)` Returns an object that represents the table identifier defined by the specified byte.
    `static TableId` | `valueOf(int tid)` Returns an object that represents the table id defined by the specified int.
    `static TableId` | `valueOf(String tidStr)` Returns an object that represents the table id defined by the specified string.

    - ### Methods inherited from class com.h3c.util.ip.U8Id

      `rangeCheck, toByte`

    - ### Methods inherited from class com.h3c.util.ip.UnsignedIntBasedId

      `equals, hashCode, toInt`

    - ### Methods inherited from class com.h3c.util.ip.UnsignedId

      `parseIntStr, parseLongStr`

    - ### Methods inherited from class com.h3c.util.cache.CacheableDataType

      `getRefQ, keyFromBytes`

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

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

- - ### Field Detail

    - #### MAX

          public static final TableId MAX

      Denotes the last usable table id number. (Tables are numbered from 0 to `TableId.MAX`.)

    - #### ALL

          public static final TableId ALL

      Denotes all tables.

  - ### Method Detail

    - #### toString

          public String toString()

      Description copied from class: `UnsignedIntBasedId`
      Returns a string representation of this id.
      Overrides:
        `toString` in class `UnsignedIntBasedId`
      Returns:
        the id, as a string

    - #### compareTo

          public int compareTo(TableId o)

      Implements the Comparable interface, to return table ids in natural order.
      Specified by:
        `compareTo` in interface `Comparable<TableId>`
      Parameters:
        `o` - the other table id
      Returns:
        an integer value indicating relative ordering
      See Also:
        `Comparable.compareTo(T)`

    - #### valueOf

          public static TableId valueOf(int tid)

      Returns an object that represents the table id defined by the specified int.
      Parameters:
        `tid` - the table id
      Returns:
        a TableId instance
      Throws:
        `IllegalArgumentException` - if the table id is invalid

    - #### valueOf

          public static TableId valueOf(String tidStr)

      Returns an object that represents the table id defined by the specified string. The string is parsed as a base-10 integer, unless it has a "0x" prefix, in which case it is parsed as a hex number.
      Parameters:
        `tidStr` - the table id as a string
      Returns:
        a TableId instance
      Throws:
        `IllegalArgumentException` - if the string is invalid
        `NullPointerException` - if the string is null

    - #### valueOf

          public static TableId valueOf(byte b)

      Returns an object that represents the table identifier defined by the specified byte.
      Parameters:
        `b` - the encoded id
      Returns:
        a TableId instance

Copyright © 2014. All Rights Reserved.