是否可以为用户定义的类型设置默认值?
即给出avdl:
protocol {
record A { }
record B {
union { A, string } foo = A;
}
}
记录B有效,默认情况下thing
是A?
答案 0 :(得分:1)
找到答案, {}
IDL:
protocol {
record A { }
record B {
union { A, string } foo = {};
}
}
导致avsc:
{
"type" : "record",
"name" : "B",
"fields" : [ {
"name" : "foo",
"type" : [ {
"type" : "record",
"name" : "A",
"fields" : [ ]
}, "string" ],
"default" : { }
} ]
}
这意味着:第一种联合的new
,在本例中为A。