public CodegenExpression EventBeanGetMappedCodegen(
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope,
     CodegenExpression beanExpression,
     CodegenExpression key)
 {
     var method = codegenMethodScope.MakeChild(
             typeof(object),
             typeof(AvroEventBeanGetterMappedRuntimeKeyed),
             codegenClassScope)
         .AddParam(typeof(EventBean), "@event")
         .AddParam(typeof(string), "key")
         .Block
         .DeclareVar<GenericRecord>(
             "record",
             CodegenExpressionBuilder.CastUnderlying(
                 typeof(GenericRecord),
                 CodegenExpressionBuilder.Ref("@event")))
         .DeclareVar<IDictionary<string, object>>(
             "values",
             CodegenExpressionBuilder.ExprDotMethod(
                 CodegenExpressionBuilder.StaticMethod(
                     typeof(GenericRecordExtensions),
                     "Get",
                     CodegenExpressionBuilder.Ref("record"),
                     CodegenExpressionBuilder.Constant(_pos.Name)),
                 "UnwrapStringDictionary"))
         .MethodReturn(
             CodegenExpressionBuilder.StaticMethod(
                 typeof(AvroEventBeanGetterMapped),
                 "GetAvroMappedValueWNullCheck",
                 CodegenExpressionBuilder.Ref("values"),
                 CodegenExpressionBuilder.Ref("key")));
     return CodegenExpressionBuilder.LocalMethodBuild(method).Pass(beanExpression).Pass(key).Call();
 }
Esempio n. 2
0
 public CodegenExpression EventBeanGetIndexedCodegen(
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope,
     CodegenExpression beanExpression,
     CodegenExpression key)
 {
     var method = codegenMethodScope.MakeChild(
             typeof(object),
             typeof(AvroEventBeanGetterIndexedRuntimeKeyed),
             codegenClassScope)
         .AddParam(typeof(EventBean), "@event")
         .AddParam(typeof(int), "index")
         .Block
         .DeclareVar<GenericRecord>(
             "record",
             CodegenExpressionBuilder.CastUnderlying(
                 typeof(GenericRecord),
                 CodegenExpressionBuilder.Ref("@event")))
         .DeclareVar<object>(
             "values",
             CodegenExpressionBuilder.StaticMethod(
                 typeof(GenericRecordExtensions),
                 "Get",
                 CodegenExpressionBuilder.Ref("record"),
                 CodegenExpressionBuilder.Constant(_pos.Name)))
         .MethodReturn(
             CodegenExpressionBuilder.StaticMethod(
                 typeof(AvroEventBeanGetterIndexed),
                 "GetAvroIndexedValue",
                 CodegenExpressionBuilder.Ref("values"),
                 CodegenExpressionBuilder.Ref("index")));
     return CodegenExpressionBuilder.LocalMethodBuild(method).Pass(beanExpression).Pass(key).Call();
 }
Esempio n. 3
0
 public CodegenExpression EventBeanExistsCodegen(
     CodegenExpression beanExpression,
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope)
 {
     return UnderlyingExistsCodegen(
         CodegenExpressionBuilder.CastUnderlying(typeof(GenericRecord), beanExpression),
         codegenMethodScope,
         codegenClassScope);
 }