Key implements Comparable<Key> { public static Key of(byte b) { return new Key(Bytes.fromByte(b)); } protected  Key(byte[] bytes); static Key fromHexString(String hexString); static Key of(byte b); static Key of(short s); static Key of(int i); static Key of(long l); static Key of(String s); @JsonCreator static Key of(@JsonProperty("bytes") byte[] bytes); byte[] getBytes(); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(Key o); @Override String toString(); String toHexString(); String toStringValue(); String toHumanReadableString(); byte toByteValue(); short toShortValue(); int toIntValue(); long toLongValue();  }
@Test public void testSerialization() throws IOException { ObjectMapper objectMapper = DefaultObjectMapper.getInstance(); Key key = Key.of("KeyName"); String jsonString = objectMapper.writeValueAsString(key); Key key2 = objectMapper.readValue(jsonString, Key.class); assertEquals(key, key2); }