code: @SneakyThrows(value = {InstantiationException.class, IllegalAccessException.class})
      public void serializeAmf3(Object obj, Amf3Type marker) throws IOException {
  
  
          if (checkReferenceable(obj, marker)) {
              return;
          }
  
          Serialization context;
          if (amf3Serializers.containsKey(obj.getClass())) {
              amf3Serializers.get(obj.getClass()).serialize(obj, out);
  
          } else if ((context = Util.searchClassHierarchy(obj.getClass(), Serialization.class)) != null && !context.deserializeOnly()) {
  
              Amf3ObjectSerializer serializer = context.amf3Serializer().newInstance();
  
              serializer.setTraitRefTable(traitRefTable);
              serializer.setTraitDefCache(traitDefCache);
              serializer.setWriter(this);
              serializer.serialize(obj, out);
          } else if (obj.getClass().isArray()) {
              // Arrays require special handling
              serializeArrayAmf3(obj);
          } else if (obj instanceof Enum) {
              // Enums are written by name
              serializeAmf3(((Enum) obj).name());
          } else {
  
              Amf3ObjectSerializer serializer = new Amf3ObjectSerializer();
              serializer.setTraitRefTable(traitRefTable);
              serializer.setTraitDefCache(traitDefCache);
              serializer.setWriter(this);
              serializer.serialize(obj, out);
          }
  
          out.flush();
      }
docs: Serializes the specified object to amf3
  @param obj The object to serialize
  @param marker The type of the object to check for referencability
  @throws IOException