com.h3c.util.ip

## Class ICMPv6Type

- java.lang.Object
- - com.h3c.util.cache.CacheableDataType
  - - com.h3c.util.ip.ICMPv6Type

- All Implemented Interfaces:
    Serializable, Comparable<ICMPv6Type>

      public final class ICMPv6Type
      extends CacheableDataType
      implements Comparable<ICMPv6Type>

  Represents an ICMPv6 message type.

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

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

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

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

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static ICMPv6Type` | `NBR_ADV` The instance representing Neighbor Advertisement.
    `static ICMPv6Type` | `NBR_SOL` The instance representing Neighbor Solicitation.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(ICMPv6Type o)` Implements the Comparable interface, to return ICMPv6 message types in natural order.
    `boolean` | `equals(Object o)`
    `int` | `getCode()` Returns the ICMPv6 message type code.
    `String` | `getDescription()` Returns the description of the ICMPv6 message type.
    `String` | `getName()` Returns the (short) name of the message type.
    `int` | `hashCode()`
    `boolean` | `isUnknown()` Returns true if the message type code is not one of the "named" types.
    `String` | `toString()` Returns a string representing the ICMPv6 message type.
    `static ICMPv6Type` | `valueOf(int typeCode)` Returns an object that represents the value of the ICMPv6 message type identified by the specified type code.
    `static ICMPv6Type` | `valueOf(String value)` Returns an object that represents the value of the ICMPv6 message type identified by the specified string.

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

    - #### NBR_SOL

          public static final ICMPv6Type NBR_SOL

      The instance representing Neighbor Solicitation.

    - #### NBR_ADV

          public static final ICMPv6Type NBR_ADV

      The instance representing Neighbor Advertisement.

  - ### Method Detail

    - #### toString

          public String toString()

      Returns a string representing the ICMPv6 message type.
      Overrides:
        `toString` in class `Object`
      Returns:
        the message type code and name

    - #### getDescription

          public String getDescription()

      Returns the description of the ICMPv6 message type. E.g. "DEST_UNR : Destination unreachable"
      Returns:
        the description

    - #### getName

          public String getName()

      Returns the (short) name of the message type. E.g. "DEST_UNR"
      Returns:
        the (short) name

    - #### getCode

          public int getCode()

      Returns the ICMPv6 message type code.
      Returns:
        the message type code

    - #### isUnknown

          public boolean isUnknown()

      Returns true if the message type code is not one of the "named" types. More specifically, the type is not defined in the icmpv6Type resource bundle.
      Returns:
        true if unknown

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### compareTo

          public int compareTo(ICMPv6Type o)

      Implements the Comparable interface, to return ICMPv6 message types in natural order.
      Specified by:
        `compareTo` in interface `Comparable<ICMPv6Type>`
      Parameters:
        `o` - the other ICMPv6 message type instance
      Returns:
        an integer value indicating relative ordering
      See Also:
        `Comparable.compareTo(T)`

    - #### valueOf

          public static ICMPv6Type valueOf(String value)

      Returns an object that represents the value of the ICMPv6 message type identified by the specified string. For example:

             ICMPv6Type rs = ICMPv6Type.valueOf("rtr_sol");
             String s = rs.getDescription(); // "RTR_SOL : Router Solicitation"
             ICMPv6Type rsAlso = ICMPv6Type.valueOf(s);
             assert rsAlso.equals(rs);

      Parameters:
        `value` - the message type identifier
      Returns:
        an object representing the specified message type

    - #### valueOf

          public static ICMPv6Type valueOf(int typeCode)

      Returns an object that represents the value of the ICMPv6 message type identified by the specified type code.
      Parameters:
        `typeCode` - the ICMPv6 message type code
      Returns:
        an object representing the specified protocol
      Throws:
        `IllegalArgumentException` - if the parameter is < 0 or > 255

Copyright © 2014. All Rights Reserved.