Esempio n. 1
0
 private string GetObjectArrayCodegen(ICodegenContext context)
 {
     return context.AddMethod(typeof(object), typeof(object[]), "array", GetType())
         .DeclareVar(typeof(object), "value",
             ArrayAtIndex(Ref("array"),
                 Constant(_propertyIndex)))
         .IfRefNullReturnNull("value")
         .IfInstanceOf("value", typeof(EventBean))
         .BlockReturn(_entryGetter.CodegenEventBeanGet(CastRef(typeof(EventBean), "value"),
             context))
         .MethodReturn(_entryGetter.CodegenUnderlyingGet(
             Cast(_entryGetter.TargetType, Ref("value")), context));
 }
 private string GetMapCodegen(ICodegenContext context)
 {
     return context.AddMethod(typeof(object), typeof(Map), "map", GetType())
         .DeclareVar(typeof(object), "value",
             ExprDotMethod(Ref("map"), "get",
                 Constant(_propertyMap)))
         .IfRefNullReturnNull("value")
         .IfInstanceOf("value", typeof(EventBean))
         .BlockReturn(_mapEntryGetter.CodegenEventBeanGet(CastRef(typeof(EventBean), "value"),
             context))
         .MethodReturn(
             _mapEntryGetter.CodegenUnderlyingGet(CastRef(_mapEntryGetter.TargetType, "value"),
                 context));
 }
Esempio n. 3
0
 public static string GetBeanArrayValueCodegen(
     ICodegenContext context,
     BeanEventPropertyGetter nestedGetter,
     int index)
 {
     return(context.AddMethod(typeof(object), typeof(object), "value", typeof(BaseNestableEventUtil))
            .IfRefNullReturnNull("value")
            .IfConditionReturnConst(
                Not(ExprDotMethodChain(Ref("value")).AddNoParam("getClass")
                    .AddNoParam("isArray")), null)
            .IfConditionReturnConst(
                Relational(StaticMethod(typeof(Array), "getLength", Ref("value")),
                           CodegenRelational.LE, Constant(index)), null)
            .DeclareVar(typeof(object), "arrayItem",
                        StaticMethod(typeof(Array), "get", Ref("value"), Constant(index)))
            .IfRefNullReturnNull("arrayItem")
            .MethodReturn(
                nestedGetter.CodegenUnderlyingGet(Cast(nestedGetter.TargetType, Ref("arrayItem")),
                                                  context)));
 }