Parameter does not have a match; SimpleXML

前端 未结 2 765
轮回少年
轮回少年 2020-12-10 15:18

I am using retrofit with the SimpleXMLConverterFactory.

And I always get an

ConstructorException: Parameter \'success\' do         


        
2条回答
  •  隐瞒了意图╮
    2020-12-10 15:43

    If you want to avoid having a deafult constructor, you would have to use both field and param use-site targets. It would look something like this:

    @Root(strict = false, name = "response")
    data class ResponseInfo(
        @field:Element(name = "success") @param:Element(name = "success") var success: String
    )
    

    As stated in this comment it seems like there isn't any way of combining the two use-site targets.

提交回复
热议问题