コード例 #1
0
 private string GetObjectArrayCodegen(ICodegenContext context)
 {
     return context.AddMethod(typeof(Object), typeof(Object[]), "array", this.GetType())
         .DeclareVar(typeof(Object), "valueTopObj", ArrayAtIndex(Ref("array"), Constant(_index)))
         .IfRefNotTypeReturnConst("valueTopObj", typeof(Map), null)
         .MethodReturn(_getter.CodegenUnderlyingGet(Cast(typeof(Map), Ref("valueTopObj")), context));
 }
コード例 #2
0
 private string GetMapMethodCodegen(ICodegenContext context)
 {
     return context.AddMethod(typeof(object), typeof(Map), "map", GetType())
         .DeclareVar(typeof(object), "valueTopObj",
             ExprDotMethod(Ref("map"), "get",
                 Constant(_propertyMap)))
         .IfRefNotTypeReturnConst("valueTopObj", typeof(Map), null)
         .DeclareVar(typeof(Map), "value", CastRef(typeof(Map), "valueTopObj"))
         .MethodReturn(_getter.CodegenUnderlyingGet(Ref("value"), context));
 }
コード例 #3
0
 private string HandleNestedValueCodegen(ICodegenContext context)
 {
     return context.AddMethod(typeof(object), typeof(object), "value", GetType())
         .IfNotInstanceOf("value", typeof(Map))
         .IfInstanceOf("value", typeof(EventBean))
         .DeclareVarWCast(typeof(EventBean), "bean", "value")
         .BlockReturn(_mapGetter.CodegenEventBeanGet(Ref("bean"), context))
         .BlockReturn(ConstantNull())
         .DeclareVarWCast(typeof(Map), "map", "value")
         .MethodReturn(_mapGetter.CodegenUnderlyingGet(Ref("map"), context));
 }