Beispiel #1
0
 private CodegenMethod GetFragmentCodegen(
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope)
 {
     return codegenMethodScope.MakeChild(typeof(object), GetType(), codegenClassScope)
         .AddParam(typeof(GenericRecord), "record")
         .Block
         .DeclareVar<object>(
             "values",
             StaticMethod(
                 typeof(GenericRecordExtensions),
                 "Get",
                 Ref("record"),
                 Constant(_posTop.Name)))
         .DeclareVar<object>(
             "value",
             StaticMethod(
                 typeof(AvroEventBeanGetterIndexed),
                 "GetAvroIndexedValue",
                 Ref("values"),
                 Constant(_index)))
         .IfRefNullReturnNull("value")
         .IfRefNotTypeReturnConst("value", typeof(GenericRecord), null)
         .MethodReturn(
             _nested.UnderlyingFragmentCodegen(
                 Cast(typeof(GenericRecord), Ref("value")),
                 codegenMethodScope,
                 codegenClassScope));
 }