com.h3c.of.lib.err

## Class ErrorCodeLookup

- java.lang.Object
- - com.h3c.of.lib.err.ErrorCodeLookup

-     public class ErrorCodeLookup
      extends Object

  Provides the facility to look up an error code based on a specified error type.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Class<? extends ErrorCode>` | `codeClass(ErrorType type)` Returns the class of error code for the given error type.
    `static ErrorCode` | `lookup(ErrorType type, int code, ProtocolVersion pv)` Looks up the error code constant for the given encoded value, based on the supplied high-level error type.
    `static void` | `validate(ErrorType type, ErrorCode code, ProtocolVersion pv)` Validates the error type/code combination for the specified protocol version, silently returning if all is well, or throwing an exception if the combination is invalid.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### lookup

          public static ErrorCode lookup(ErrorType type,
                         int code,
                         ProtocolVersion pv)
                                  throws DecodeException

      Looks up the error code constant for the given encoded value, based on the supplied high-level error type.
      Parameters:
        `type` - the error type
        `code` - the error code value to look up
        `pv` - the protocol version
      Returns:
        the appropriate error code constant
      Throws:
        `DecodeException` - if the code value cannot be decoded

    - #### codeClass

          public static Class<? extends ErrorCode> codeClass(ErrorType type)

      Returns the class of error code for the given error type.
      Parameters:
        `type` - the error type
      Returns:
        the class of the corresponding error codes

    - #### validate

          public static void validate(ErrorType type,
                      ErrorCode code,
                      ProtocolVersion pv)

      Validates the error type/code combination for the specified protocol version, silently returning if all is well, or throwing an exception if the combination is invalid.
      Parameters:
        `code` - the error code
        `type` - the error type
        `pv` - the protocol version

Copyright © 2014. All Rights Reserved.