com.h3c.util.ip

## Class EthernetType

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

- All Implemented Interfaces:
    Serializable, Comparable<EthernetType>

      public final class EthernetType
      extends CacheableDataType
      implements Comparable<EthernetType>

  Represents an Ethernet frame type.

  All constructors for this class are private. Creating instances of `EthernetType` 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 ethernet types is presented in an intuitive order.

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static EthernetType` | `ARP` The instance representing ARP (0x0806).
    `static EthernetType` | `BDDP` The instance representing BDDP (0x8999).
    `static EthernetType` | `IPv4` The instance representing IPv4 (0x0800).
    `static EthernetType` | `IPv6` The instance representing IPv6 (0x86dd).
    `static int` | `LENGTH_IN_BYTES` Length of an Ethernet type when encoded as a byte array.
    `static EthernetType` | `LLDP` The instance representing LLDP (0x88cc).
    `static EthernetType` | `MPLS_M` The instance representing MPLS (multicast) (0x8848).
    `static EthernetType` | `MPLS_U` The instance representing MPLS (unicast) (0x8847).
    `static EthernetType` | `PBB` The instance representing PBB (0x88e7).
    `static EthernetType` | `PRV_BRDG` The instance representing PRV_BRDG (0x88a8).
    `static EthernetType` | `RARP` The instance representing RARP (0x8035).
    `static EthernetType` | `SNMP` The instance representing SNMP (0x814c).
    `static EthernetType` | `VLAN` The instance representing VLAN (0x8100).

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(EthernetType o)` Implements the Comparable interface, to return Ethernet types in natural order.
    `boolean` | `equals(Object o)`
    `String` | `getName()` Returns the descriptive name of the Ethernet type.
    `int` | `getNumber()` Returns the Ethernet type number.
    `String` | `getShortName()` Returns the short name of the Ethernet type.
    `int` | `hashCode()`
    `boolean` | `isUnknown()` Returns true if the ethernet type number is not one of the "named" Ethernet types.
    `String` | `toString()` Returns a string describing the Ethernet type.
    `static EthernetType` | `valueOf(int typeNumber)` Returns an object that represents the value of the Ethernet type identified by the specified number.
    `static EthernetType` | `valueOf(String value)` Returns an object that represents the value of the Ethernet 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

    - #### LENGTH_IN_BYTES

          public static final int LENGTH_IN_BYTES

      Length of an Ethernet type when encoded as a byte array.
      See Also:
        Constant Field Values

    - #### IPv4

          public static final EthernetType IPv4

      The instance representing IPv4 (0x0800).

    - #### ARP

          public static final EthernetType ARP

      The instance representing ARP (0x0806).

    - #### RARP

          public static final EthernetType RARP

      The instance representing RARP (0x8035).

    - #### VLAN

          public static final EthernetType VLAN

      The instance representing VLAN (0x8100).

    - #### SNMP

          public static final EthernetType SNMP

      The instance representing SNMP (0x814c).

    - #### IPv6

          public static final EthernetType IPv6

      The instance representing IPv6 (0x86dd).

    - #### MPLS_U

          public static final EthernetType MPLS_U

      The instance representing MPLS (unicast) (0x8847).

    - #### MPLS_M

          public static final EthernetType MPLS_M

      The instance representing MPLS (multicast) (0x8848).

    - #### PRV_BRDG

          public static final EthernetType PRV_BRDG

      The instance representing PRV_BRDG (0x88a8).

    - #### LLDP

          public static final EthernetType LLDP

      The instance representing LLDP (0x88cc).

    - #### PBB

          public static final EthernetType PBB

      The instance representing PBB (0x88e7).

    - #### BDDP

          public static final EthernetType BDDP

      The instance representing BDDP (0x8999).

  - ### Method Detail

    - #### toString

          public String toString()

      Returns a string describing the Ethernet type.
      Overrides:
        `toString` in class `Object`
      Returns:
        the Ethernet type number and name

    - #### getName

          public String getName()

      Returns the descriptive name of the Ethernet type. E.g. "IPv4 : Internet Protocol IPv4"
      Returns:
        the descriptive name

    - #### getShortName

          public String getShortName()

      Returns the short name of the Ethernet type. E.g. "IPv4"
      Returns:
        the short name

    - #### getNumber

          public int getNumber()

      Returns the Ethernet type number.
      Returns:
        the type number

    - #### isUnknown

          public boolean isUnknown()

      Returns true if the ethernet type number is not one of the "named" Ethernet types. More specifically, the type is not defined in the ethernetType 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(EthernetType o)

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

    - #### valueOf

          public static EthernetType valueOf(String value)

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

             EthernetType arp = EthernetType.valueOf("arp");
             String s = arp.getName(); // "ARP : Address Resolution Protocol"
             EthernetType arpAlso = EthernetType.valueOf(s);
             assert arpAlso.equals(arp);

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

    - #### valueOf

          public static EthernetType valueOf(int typeNumber)

      Returns an object that represents the value of the Ethernet type identified by the specified number.
      Parameters:
        `typeNumber` - the Ethernet type number
      Returns:
        an object representing the specified Ethernet type
      Throws:
        `IllegalArgumentException` - if the parameter is < 0 or > 0xffff

Copyright © 2014. All Rights Reserved.