avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yang <teddyyyy...@gmail.com>
Subject how to utilize default?
Date Thu, 28 Jul 2011 19:25:37 GMT
the schema in http://avro.apache.org/docs/1.5.1/spec.html#schema_record
allows definition of { "default": my_default_value ..... }

but I guess I can't simply access a record field by

my_record_obj.my_field_name

and hope to get the default value , right? but then how can the
default value be obtained?

Thanks
Yang





############ java code
package blah;
public class aaa {
public static void main(String args[]){
MyClass o = new MyClass();
System.out.println(o.my_field);
}
}

############ avdl fle:
@namespace("blah")
protocol MyProto {
    record MyClass {
        long  my_field=1;
    }
    int my_func(MyClass c);
}

Mime
View raw message