code: protected void write(JsonWriter out, T value, TypeAdapter<JsonElement> elementAdapter, TypeAdapter<T> delegate) throws IOException {
          JsonElement tree = delegate.toJsonTree(value);
          beforeWrite(value, tree);
          elementAdapter.write(out, tree);
      }
docs: Override this to define how this is serialized in {@code toSerialize} to
  the outgoing JSON stream.