code: public byte[] toByteArray(final ArrayOfItemsSerDe<T> serDe) {
      if ((gadget_ == null) || (gadget_.getNumSamples() == 0)) {
        return toByteArray(serDe, null);
      } else {
        return toByteArray(serDe, gadget_.getValueAtPosition(0).getClass());
      }
    }
docs: Returns a byte array representation of this union
  
  @param serDe An instance of ArrayOfItemsSerDe
  @return a byte array representation of this union