@Override
      public Span fromJson(JsonReader reader) throws IOException {
        Span.Builder result = Span.newBuilder();
        reader.beginObject();
        while (reader.hasNext()) {
          String nextName = reader.nextName();
          if (reader.peek() == JsonReader.Token.NULL) {
            reader.skipValue();
            continue;
          }
          switch (nextName) {
            case "traceId":
              result.traceId(reader.nextString());
              break;
            case "parentId":
              result.parentId(reader.nextString());
              break;
            case "id":
              result.id(reader.nextString());
              break;
            case "kind":
              result.kind(Span.Kind.valueOf(reader.nextString()));
              break;
            case "name":
              result.name(reader.nextString());
              break;
            case "timestamp":
              result.timestamp(reader.nextLong());
              break;
            case "duration":
              result.duration(reader.nextLong());
              break;
            case "localEndpoint":
              result.localEndpoint(ENDPOINT_ADAPTER.fromJson(reader));
              break;
            case "remoteEndpoint":
              result.remoteEndpoint(ENDPOINT_ADAPTER.fromJson(reader));
              break;
            case "annotations":
              reader.beginArray();
              while (reader.hasNext()) {
                Annotation a = ANNOTATION_ADAPTER.fromJson(reader);
                result.addAnnotation(a.timestamp(), a.value());
              }
              reader.endArray();
              break;
            case "tags":
              reader.beginObject();
              while (reader.hasNext()) {
                result.putTag(reader.nextName(), reader.nextString());
              }
              reader.endObject();
              break;
            case "debug":
              result.debug(reader.nextBoolean());
              break;
            case "shared":
              result.shared(reader.nextBoolean());
              break;
            default:
              reader.skipValue();
          }
        }
        reader.endObject();
        return result.build();
      }
Read-only json adapters resurrected from before we switched to Java 6 as storage components can
be Java 7+
benchmarks/src/test/java/zipkin2/codec/MoshiSpanDecoder.java