Source:
public String serialize(Serializable payload) throws SerializationExeption { ObjectMapper mapper = new ObjectMapper(); mapper.getSerializationConfig().addMixInAnnotations(NGuid.class, JsonNGuidMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(Guid.class, JsonNGuidMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(VdcActionParametersBase.class, JsonVdcActionParametersBaseMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(IVdcQueryable.class, JsonIVdcQueryableMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(VM.class, JsonVmMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(ValueObjectMap.class, JsonValueObjectMapMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(VdsStatic.class, JsonVdsStaticMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(VDS.class, JsonVDSMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(VmTemplate.class, JsonVmTemplateMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(AddVmFromTemplateParameters.class, JsonAddVmFromTemplateParametersMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(MoveOrCopyParameters.class, JsonMoveOrCopyParametersMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(AddVmTemplateParameters.class, JsonAddVmTemplateParametersMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(VmManagementParametersBase.class, JsonVmManagementParametersBaseMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(VmBase.class, JsonVmBaseMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(VmStatic.class, JsonVmStaticMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(VmTemplate.class, JsonVmTemplateMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(AddVmFromSnapshotParameters.class, JsonAddVmFromSnapshotParametersMixIn.class); mapper.configure(Feature.INDENT_OUTPUT, true); mapper.enableDefaultTyping(); return writeJsonAsString(payload, mapper); }

Target:
public String serialize(Serializable payload) throws SerializationExeption { ObjectMapper mapper = new ObjectMapper(); mapper.getSerializationConfig().addMixInAnnotations(NGuid.class, JsonNGuidMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(Guid.class, JsonNGuidMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(VdcActionParametersBase.class, JsonVdcActionParametersBaseMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(IVdcQueryable.class, JsonIVdcQueryableMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(VM.class, JsonVmMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(ValueObjectMap.class, JsonValueObjectMapMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(VdsStatic.class, JsonVdsStaticMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(VDS.class, JsonVDSMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(VmTemplate.class, JsonVmTemplateMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(AddVmFromTemplateParameters.class, JsonAddVmFromTemplateParametersMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(MoveOrCopyParameters.class, JsonMoveOrCopyParametersMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(AddVmTemplateParameters.class, JsonAddVmTemplateParametersMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(VmManagementParametersBase.class, JsonVmManagementParametersBaseMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(VmBase.class, JsonVmBaseMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(VmStatic.class, JsonVmStaticMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(AddVmFromSnapshotParameters.class, JsonAddVmFromSnapshotParametersMixIn.class); mapper.configure(Feature.INDENT_OUTPUT, true); mapper.enableDefaultTyping(); return writeJsonAsString(payload, mapper); }