code: @SuppressWarnings("unchecked")
      public Object marshal(Object o) throws RpcException {
          if (o == null) {
              return returnNullIfOptional();
          }
          else if (o instanceof BStruct) {
              return validateMap(structToMap(o, this.s), this.s);
          }
          else if (o instanceof Map) {
              return validateMap((Map)o, this.s);
          }
          else {
              String msg = "Unable to convert class: " + o.getClass().getName();
              throw RpcException.Error.INVALID_RESP.exc(msg);
          }
      }
docs: Marshals native Java type o to a Map that can be serialized.
  Recursively marshals all of the Struct fields from o onto the map.
  
  @param o Java object to marshal to Map
  @return Map containing the marshaled data
  @throws RpcException If o does not validate against the Struct spec in the IDL.
  The most common validation error will be null properties on o for Struct
  fields that are not marked optional.