此Java代码段的等效Kotlin代码是什么?
@Data
@Entity
@TypeDefs({
@TypeDef(name = "string-array", typeClass = StringArrayType.class),
@TypeDef(name = "int-array", typeClass = IntArrayType.class),
@TypeDef(name = "json", typeClass = JsonStringType.class),
@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)
})
public class Parent implements Serializable {
//....
}
最后跟随代码工作。
@TypeDefs(
TypeDef(name = "string-array", typeClass = StringArrayType::class),
TypeDef(name = "int-array", typeClass = IntArrayType::class),
TypeDef(name = "json", typeClass = JsonStringType::class),
TypeDef(name = "jsonb", typeClass = JsonBinaryType::class)
)
答案 0 :(得分:1)
试试这个。
@Data
@Entity
@TypeDefs(
TypeDef(name = "string-array", typeClass = StringArrayType::class.java),
TypeDef(name = "int-array", typeClass = IntArrayType::class.java),
TypeDef(name = "json", typeClass = JsonStringType::class.java),
TypeDef(name = "jsonb", typeClass = JsonBinaryType::class.java))
class Parent : Serializable