public static io.opencensus.trace.MessageEvent asMessageEvent(
      io.opencensus.trace.BaseMessageEvent event) {
    Utils.checkNotNull(event, "event");
    if (event instanceof io.opencensus.trace.MessageEvent) {
      return (io.opencensus.trace.MessageEvent) event;
    }
    io.opencensus.trace.NetworkEvent networkEvent = (io.opencensus.trace.NetworkEvent) event;
    io.opencensus.trace.MessageEvent.Type type =
        (networkEvent.getType() == io.opencensus.trace.NetworkEvent.Type.RECV)
            ? io.opencensus.trace.MessageEvent.Type.RECEIVED
            : io.opencensus.trace.MessageEvent.Type.SENT;
    return io.opencensus.trace.MessageEvent.builder(type, networkEvent.getMessageId())
        .setUncompressedMessageSize(networkEvent.getUncompressedMessageSize())
        .setCompressedMessageSize(networkEvent.getCompressedMessageSize())
        .build();
  }
public static io . opencensus . trace . MessageEvent asMessageEvent ( io . opencensus . trace . BaseMessageEvent event ) { Utils . checkNotNull ( event , "event" ) ; if ( event instanceof io . opencensus . trace . MessageEvent ) { return ( io . opencensus . trace . MessageEvent ) event ; } io . opencensus . trace . NetworkEvent networkEvent = ( io . opencensus . trace . NetworkEvent ) event ; io . opencensus . trace . MessageEvent . Type type = ( networkEvent . getType ( ) == io . opencensus . trace . NetworkEvent . Type . RECV ) ? io . opencensus . trace . MessageEvent . Type . RECEIVED : io . opencensus . trace . MessageEvent . Type . SENT ; return io . opencensus . trace . MessageEvent . builder ( type , networkEvent . getMessageId ( ) ) . setUncompressedMessageSize ( networkEvent . getUncompressedMessageSize ( ) ) . setCompressedMessageSize ( networkEvent . getCompressedMessageSize ( ) ) . build ( ) ; }
Cast or convert a {@link io.opencensus.trace.BaseMessageEvent} to {@link
io.opencensus.trace.MessageEvent}.

<p>Warning: if the input is a {@code io.opencensus.trace.NetworkEvent} and contains {@code
kernelTimestamp} information, this information will be dropped.

@param event the {@code BaseMessageEvent} that is being cast or converted.
@return a {@code MessageEvent} representation of the input.