示例#1
0
 @Nonnull
 public static <T extends Enum<T> & Code.DescriptiveWrapper> String toString(@Nonnull T value) {
   return value.name()
       + "(0x"
       + UnsignedBytes.toString(value.getCode(), 16)
       + "): "
       + value.getDescription();
 }
 @Override
 public void toStringBuilder(StringBuilder buf, int depth) {
   appendHeader(buf, depth, getClass().getSimpleName());
   depth++;
   appendValue(buf, depth, "MessageTag", "0x" + UnsignedBytes.toString(messageTag, 16));
   appendValue(buf, depth, "RequestedMaximumPrivilegeLevel", requestedMaximumPrivilegeLevel);
   appendValue(buf, depth, "ConsoleSessionId", "0x" + Integer.toHexString(consoleSessionId));
   appendValue(buf, depth, "AuthenticationAlgorithm", authenticationAlgorithm);
   appendValue(buf, depth, "IntegrityAlgorithm", integrityAlgorithm);
   appendValue(buf, depth, "ConfidentialityAlgorithm", confidentialityAlgorithm);
 }
示例#3
0
 @Nonnull
 public static <T extends Enum<T> & Code.Wrapper> T fromByte(@Nonnull Class<T> type, byte code) {
   for (T value : type.getEnumConstants()) if (value.getCode() == code) return value;
   throw new IllegalArgumentException(
       "Unknown " + type.getSimpleName() + " code 0x" + UnsignedBytes.toString(code, 16));
 }