code: protected void serialize(BinderContext context, E object, SerializerWrapper serializerWrapper, boolean writeStartAndEnd) throws Exception {
  
  		switch (context.getSupportedFormat()) {
  		case XML:
  			try {
  				XmlWrapperSerializer wrapper = ((XmlWrapperSerializer) serializerWrapper);
  				XMLSerializer xmlSerializer=wrapper.xmlSerializer;
  
  				if (writeStartAndEnd) {
  					xmlSerializer.writeStartDocument();
  				}
  				serializeOnXml(object, xmlSerializer, 0);
  
  				if (writeStartAndEnd) {
  					xmlSerializer.writeEndDocument();
  				}
  			} catch (Exception e) {
  				e.printStackTrace();
  				throw (new KriptonRuntimeException(e));
  			}
  			break;
  		default:
  			if (context.getSupportedFormat().onlyText)
  				serializeOnJacksonAsString(object, ((JacksonWrapperSerializer) serializerWrapper).jacksonGenerator);
  			else
  				serializeOnJackson(object, ((JacksonWrapperSerializer) serializerWrapper).jacksonGenerator);
  			break;
  		}
  	}
docs: Serialize an object using the contxt and the serializerWrapper.
  
  @param context the context
  @param object the object
  @param serializerWrapper the serializer wrapper
  @param writeStartAndEnd the write start and end
  @throws Exception the exception