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)); }
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)); }
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)); }