docs: @Override
      public void writeObject(Object value) throws JMSException {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              SibTr.entry(tc, "writeObject");
  
          // Check if the producer has promised not to modify the payload after it's been set
          checkProducerPromise("writeObject(Object)", "JmsBytesMessageImpl.writeObject#1");
  
          // Check that we are in write mode (doing this test here ensures
          // any error message refers to the correct method)
          checkBodyWriteable("writeObject");
  
          if (value instanceof byte[])
              writeBytes((byte[]) value);
          else if (value instanceof String)
              writeUTF((String) value);
          else if (value instanceof Integer)
              writeInt(((Integer) value).intValue());
          else if (value instanceof Byte)
              writeByte(((Byte) value).byteValue());
          else if (value instanceof Short)
              writeShort(((Short) value).shortValue());
          else if (value instanceof Long)
              writeLong(((Long) value).longValue());
          else if (value instanceof Float)
              writeFloat(((Float) value).floatValue());
          else if (value instanceof Double)
              writeDouble(((Double) value).doubleValue());
          else if (value instanceof Character)
              writeChar(((Character) value).charValue());
          else if (value instanceof Boolean)
              writeBoolean(((Boolean) value).booleanValue());
          else if (value == null) {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  SibTr.debug(this, tc, "given null, throwing NPE");
              throw new NullPointerException();
          }
          else {
              // d238447 FFDC review. Passing in an object of the wrong type is an app error,
              // so no FFDC needed here.
              throw (JMSException) JmsErrorUtils.newThrowable(
                                                              MessageFormatException.class,
                                                              "BAD_OBJECT_CWSIA0185",
                                                              new Object[] { value.getClass().getName() },
                                                              tc);
          }
  
          // Invalidate the cached toString object.
          cachedBytesToString = null;
  
          // Ensure that the new data gets exported when the time comes.
          bodySetInJsMsg = false;
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              SibTr.exit(tc, "writeObject");
      }