Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/197.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 用于使用Jackson序列化yml文件的数据对象_Java_Android_Kotlin - Fatal编程技术网

Java 用于使用Jackson序列化yml文件的数据对象

Java 用于使用Jackson序列化yml文件的数据对象,java,android,kotlin,Java,Android,Kotlin,我正在尝试序列化.yml文件,但收到消息: 原因:com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException:无法识别的字段“text”(class com.core.storage.Content),未标记为可忽略(两个已知属性:“check”,“label”) 如消息所示,我不希望属性“check”和“label”可忽略。以下是我的数据对象: class CheckList( index: Int,

我正在尝试序列化.yml文件,但收到消息:

原因:com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException:无法识别的字段“text”(class com.core.storage.Content),未标记为可忽略(两个已知属性:“check”,“label”)

如消息所示,我不希望属性“check”和“label”可忽略。以下是我的数据对象:

class CheckList(
        index: Int, 
        @JsonProperty("list") content: MutableList<Content> = arrayListOf())

@JsonPropertyOrder("check", "label")
class Content(@JsonProperty("check") val check: String = "",
              @JsonProperty("label") val label: String = "")
确保对属性使用“val”:

class CheckList(
    val index: Int,
    @JsonProperty("list") val content: MutableList<Content> = arrayListOf())
课程清单(
val索引:Int,
@JsonProperty(“列表”)val内容:MutableList=arrayListOf()

谢谢!实际上,我犯了一些小错误,比如没有像你说的那样将属性设置为val,我没有更新我的yaml文档,有一个“文本”字段。
index: 100
list:
- check: Avoid regular phone calls for sensitive conversations
- check: Use Signal for secure calls
- check: Use JitsiMeet for video conferencing
- label: If you must use less secure options
- check: Download from official website
- check: Change password regularly
- check: Adjust settings so you don't keep chat history
- check: Verify who you're speaking to
- check: Consider using anonymous username
- check: Use codes for sensitive topics
class CheckList(
    val index: Int,
    @JsonProperty("list") val content: MutableList<Content> = arrayListOf())