docs: @Override
      public byte[] serialize(Object theObject)
      {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
          {
              Tr.entry(tc, "serialize = " + theObject.getClass());
          }
  
          byte[] idBytes = null;
  
          if (theObject instanceof WrapperProxy) // F58064
          {
              WrapperProxyState state = WrapperProxyState.getWrapperProxyState(theObject);
              idBytes = state.getSerializerBytes();
  
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  Tr.debug(tc, "serialized a WrapperProxy for " + state);
          }
          else
          {
              EJSWrapperBase wrapper = null;
              if (theObject instanceof EJSWrapperBase)
              {
                  wrapper = (EJSWrapperBase) theObject;
              }
              else if (theObject instanceof LocalBeanWrapper) // d609263
              {
                  wrapper = EJSWrapperCommon.getLocalBeanWrapperBase((LocalBeanWrapper) theObject);
              }
              else
              {
                  throw new IllegalArgumentException(" theObject parameter must be a EJB_LOCAL, EJB_LOCAL_HOME"
                                                     + ", EJB_BUSINESS_LOCAL, or EJB_BUSINESS_REMOTE ObjectType. Use the getObjectType"
                                                     + " to obtain the ObjectType.");
              }
  
              // Get the BeanId and WrapperInterface from the wrapper.
              BeanId beanId = wrapper.beanId;
              WrapperInterface wrapperInterface = wrapper.ivInterface;
              BeanMetaData bmd = wrapper.bmd;
  
              // Use type of wrapper interface to determine whether to
              // serialize a WrapperId or a BeanId object.
              if (wrapperInterface == WrapperInterface.BUSINESS_LOCAL)
              {
                  // Serialize a WrapperId for local business interface.
                  int interfaceIndex = wrapper.ivBusinessInterfaceIndex;
                  String interfaceName;
                  if (interfaceIndex == EJSWrapperBase.AGGREGATE_LOCAL_INDEX) { // F743-34304
                      interfaceName = EJSWrapperBase.AGGREGATE_EYE_CATCHER; // d677413
                  } else {
                      Class<?> biClass = bmd.ivBusinessLocalInterfaceClasses[interfaceIndex];
                      interfaceName = biClass.getName();
                  }
                  WrapperId wrapperId = new WrapperId(beanId.getByteArrayBytes() //d458325
                  , interfaceName
                                  , interfaceIndex);
                  idBytes = wrapperId.getBytes();
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  {
                      Tr.debug(tc, "serialized a WrapperId for BeanId = " + beanId
                                   + ", local business interface = " + interfaceName);
                  }
              }
              else if (wrapperInterface == WrapperInterface.BUSINESS_REMOTE)
              {
                  // Serialize a WrapperId for remote business interface.
                  int interfaceIndex = wrapper.ivBusinessInterfaceIndex;
                  Class<?> biClass = bmd.ivBusinessRemoteInterfaceClasses[interfaceIndex];
                  String interfaceName = biClass.getName();
                  WrapperId wrapperId = new WrapperId(beanId.getByteArrayBytes() //d458325
                  , interfaceName
                                  , interfaceIndex);
                  idBytes = wrapperId.getBytes();
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  {
                      Tr.debug(tc, "serialized a WrapperId for BeanId = " + beanId
                                   + ", remote business interface = " + interfaceName);
                  }
              }
              else if (wrapperInterface == WrapperInterface.BUSINESS_RMI_REMOTE)
              {
                  // Serialize a WrapperId for a RMI remote business interface.
                  int interfaceIndex = wrapper.ivBusinessInterfaceIndex;
                  Class<?> biClass = bmd.ivBusinessRemoteInterfaceClasses[interfaceIndex];
                  String interfaceName = biClass.getName();
                  WrapperId wrapperId = new WrapperId(beanId.getByteArrayBytes() //d458325
                  , interfaceName
                                  , interfaceIndex);
                  idBytes = wrapperId.getBytes();
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  {
                      Tr.debug(tc, "serialized a WrapperId for BeanId = " + beanId
                                   + ", RMI remote business interface = " + interfaceName);
                  }
              }
              else
              {
                  // Not a business interface, so must be a local or remote interface of
                  // a 2.1 bean or a 2.1 view of a EJB 3 bean.  Either case, we only need
                  // to save the BeanId for this kind of wrapper.
                  idBytes = beanId.getByteArrayBytes(); //d466573
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  {
                      Tr.debug(tc, "serialized a BeanId = " + beanId);
                  }
              }
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
          {
              Tr.exit(tc, "serialize");
          }
  
          return idBytes;
      }