com.h3c.util.ip

## Class AlphaNumericName

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

- All Implemented Interfaces:
    Serializable, Comparable<AlphaNumericName>

      public final class AlphaNumericName
      extends CacheableDataType
      implements Comparable<AlphaNumericName>

  Represents an alpha-numeric name.

  All constructors for this class are private. Creating instances of `AlphaNumericName` 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 names is presented in an intuitive order. In particular, case is ignored, and numeric suffixes are taken into account. For example:

  - `A1`
  - `A2`
  - `A3`
  - `A11`
  - `A12`
  - `A20`
  - `B1`
  - `B5`
  - `B12`
  See Also:
    Serialized Form

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(AlphaNumericName other)` Overridden to (a) ignore case, and (b) take embedded numbers into account.
    `boolean` | `equals(Object o)`
    `int` | `hashCode()`
    `String` | `toString()`
    `static AlphaNumericName` | `valueOf(String str)` Returns an object representing the value of the specified alpha-numeric name.

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

- - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### compareTo

          public int compareTo(AlphaNumericName other)

      Overridden to (a) ignore case, and (b) take embedded numbers into account.
      Specified by:
        `compareTo` in interface `Comparable<AlphaNumericName>`
      Parameters:
        `other` - the other instance we are comparing to
      Returns:
        a number less than, equal to, or greater than zero as this instance is earlier than, the same as, or later than the other in natural sort order

    - #### equals

          public boolean equals(Object o)

      Note that this comparison ignores case.

      Overrides:
        `equals` in class `Object`
      Parameters:
        `o` - the other instance to compare to
      Returns:
        true if this instance is equivalent to the specified instance

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### valueOf

          public static AlphaNumericName valueOf(String str)

      Returns an object representing the value of the specified alpha-numeric name. Note that the parameter to this method is trimmed of whitespace.
      Parameters:
        `str` - the string representation of the alpha-numeric name
      Returns:
        an AlphaNumericName instance
      Throws:
        `NullPointerException` - if the string is null
        `IllegalArgumentException` - if the string is blank

Copyright © 2014. All Rights Reserved.