@SuppressWarnings("unchecked") static <T extends Payload<?>> T fromPb(com.google.logging.v2.LogEntry entryPb) { switch (entryPb.getPayloadCase()) { case TEXT_PAYLOAD: return (T) StringPayload.fromPb(entryPb); case JSON_PAYLOAD: return (T) JsonPayload.fromPb(entryPb); case PROTO_PAYLOAD: return (T) ProtoPayload.fromPb(entryPb); case PAYLOAD_NOT_SET: return null; default: // should never occur throw new IllegalArgumentException("Unrecognized log entry payload"); } } }
@SuppressWarnings("unchecked") static <T extends Payload<?>> T fromPb(com.google.logging.v2.LogEntry entryPb) { switch (entryPb.getPayloadCase()) { case TEXT_PAYLOAD: return (T) StringPayload.fromPb(entryPb); case JSON_PAYLOAD: return (T) JsonPayload.fromPb(entryPb); case PROTO_PAYLOAD: return (T) ProtoPayload.fromPb(entryPb); case PAYLOAD_NOT_SET: return null; default: // should never occur throw new IllegalArgumentException("Unrecognized log entry payload"); } } }