我们希望能够将unmappedSourcePolicy设置为ReportingPolicy.ERROR,以便默认情况下丢失的源会大声失败。但是,有时源对象模型包含与目标无关的内容。因此,我们希望能够做类似的事情:
@Mapping(source = "fieldToIgnore", ignore = true)
可以像目标一样进行。如果尝试上述操作,则会出错,因为映射中需要目标。
答案 0 :(得分:0)
使用Sub getJsonResult()
Dim objRequestt As Object
Dim strUrl As String
Dim blnAsync As Boolean
Dim strUrlXBTUSD As String
Dim strResponse As String
Dim jsonText As String
Dim jsonObject As Object, item As Object
Dim i As Integer
'setting up the variable to 0 or nothing
strUrlXBTUSD = ""
strResponsee = ""
jsonText = ""
i = 0
blnAsync = False
Set item = Nothing
Set jsonObject = Nothing
Set objRequestt = Nothing
Set objRequestt = CreateObject("MSXML2.XMLHTTP")
strUrlXBTUSD = "https://www.bitmex.com/api/v1/orderBook/L2?symbol=XBTUSD&depth=3"
blnAsync = True
'Starting the GET request
ThisWorkbook.Activate
With objRequestt
.Open "GET", strUrlXBTUSD, blnAsync
.SetRequestHeader "Content-Type", "application/json"
.send
strResponse = .responseText 'here the response is always the same except if i Close Excel
Debug.Print strResponsee
End With
End Sub
可以忽略源属性。您可以的话
BeanMapping#ignoreUnmappedSourceProperties