code: void generateSerializeInternal(BindTypeContext context, MethodSpec.Builder methodBuilder, String serializerName, TypeName beanClass, String beanName, BindProperty property, boolean onString) {
  		TypeName typeName = property.getPropertyType().getTypeName();
  
  		String bindName = context.getBindMapperName(context, typeName);
  
  		// @formatter:off
  		if (property.isNullable()) {
  			methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property));
  		}
  
  		if (property.isProperty()) {
  			methodBuilder.addStatement("fieldCount++");
  		}
  
  		if (!property.isInCollection()) {
  			methodBuilder.addStatement("$L.writeFieldName($S)", serializerName, property.label);
  		}
  
  		if (onString) {
  			methodBuilder.beginControlFlow("if ($L.serializeOnJacksonAsString($L, jacksonSerializer)==0)", bindName,
  					getter(beanName, beanClass, property));
  			// KRITPON-38: in a collection, for null object we write
  			methodBuilder.addStatement("$L.writeNullField($S)", serializerName, property.label);
  			methodBuilder.endControlFlow();
  		} else {
  			methodBuilder.addStatement("$L.serializeOnJackson($L, jacksonSerializer)", bindName, getter(beanName, beanClass, property));
  		}
  
  		if (property.isNullable()) {
  			methodBuilder.endControlFlow();
  		}
  		// @formatter:on
  	}
docs: Generate serialize internal.
  
  @param context the context
  @param methodBuilder the method builder
  @param serializerName the serializer name
  @param beanClass the bean class
  @param beanName the bean name
  @param property the property
  @param onString the on string