public CodegenExpression EvaluateCodegen(
            Type requiredType,
            CodegenMethodScope codegenMethodScope,
            ExprForgeCodegenSymbol exprSymbol,
            CodegenClassScope codegenClassScope)
        {
            CodegenMethod methodNode = codegenMethodScope.MakeChild(
                typeof(ICollection<object>),
                GetType(),
                codegenClassScope);
            CodegenExpressionRef refEPS = exprSymbol.GetAddEPS(methodNode);

            methodNode.Block
                .DeclareVar<EventBean>(
                    "@event",
                    CodegenExpressionBuilder.ArrayAtIndex(refEPS, CodegenExpressionBuilder.Constant(_streamNum)))
                .IfRefNullReturnNull("@event")
                .DeclareVar<object[]>(
                    "result",
                    CodegenExpressionBuilder.Cast(
                        typeof(object[]),
                        _getter.EventBeanGetCodegen(
                            CodegenExpressionBuilder.Ref("@event"),
                            methodNode,
                            codegenClassScope)))
                .IfRefNullReturnNull("result")
                .MethodReturn(
                    CodegenExpressionBuilder.StaticMethod(
                        typeof(CompatExtensions),
                        "AsList",
                        CodegenExpressionBuilder.Ref("result")));
            return CodegenExpressionBuilder.LocalMethod(methodNode);
        }
示例#2
0
 private CodegenMethod IsExistsPropertyCodegen(
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope)
 {
     return codegenMethodScope.MakeChild(typeof(bool), GetType(), codegenClassScope)
         .AddParam(typeof(GenericRecord), "record")
         .Block
         .DeclareVar<Field>(
             "field",
             CodegenExpressionBuilder.ExprDotMethodChain(CodegenExpressionBuilder.Ref("record"))
                 .Get("Schema")
                 .Add("GetField", CodegenExpressionBuilder.Constant(_fieldTop)))
         .IfRefNullReturnFalse("field")
         .DeclareVar<object>(
             "inner",
             CodegenExpressionBuilder.StaticMethod(
                 typeof(GenericRecordExtensions),
                 "Get",
                 CodegenExpressionBuilder.Ref("record"),
                 CodegenExpressionBuilder.Constant(_fieldTop)))
         .IfRefNotTypeReturnConst("inner", typeof(GenericRecord), false)
         .MethodReturn(
             _getter.UnderlyingExistsCodegen(
                 CodegenExpressionBuilder.Cast(typeof(GenericRecord), CodegenExpressionBuilder.Ref("inner")),
                 codegenMethodScope,
                 codegenClassScope));
 }
 public CodegenExpression ToExpression() {
     return CodegenExpressionBuilder.NewInstance(
         typeof(ConfigurationCompilerPlugInAggregationMultiFunction),
         CodegenExpressionBuilder.Constant(FunctionNames),
         CodegenExpressionBuilder.Constant(MultiFunctionForgeClassName),
         CodegenExpressionBuilder.MapOfConstant(AdditionalConfiguredProperties));
 }
示例#4
0
 public CodegenExpression Codegen(
     CodegenMethod method,
     CodegenClassScope classScope,
     CodegenExpression typeInitSvcRef)
 {
     return(CodegenExpressionBuilder.NewInstance <ClassEPType>(CodegenExpressionBuilder.Constant(Clazz)));
 }
示例#5
0
            public CodegenExpression Codegen(
                CodegenMethodScope codegenMethodScope,
                CodegenClassScope codegenClassScope,
                CodegenExpressionRef left,
                CodegenExpressionRef right,
                Type ltype,
                Type rtype)
            {
                var method = codegenMethodScope.MakeChild(typeof(int?), typeof(DivideInt), codegenClassScope)
                             .AddParam(typeof(int?), "i1")
                             .AddParam(typeof(int?), "i2")
                             .Block

                             .IfCondition(
                    CodegenExpressionBuilder.EqualsIdentity(
                        CodegenExpressionBuilder.Ref("i2"),
                        CodegenExpressionBuilder.Constant(0)))
                             .BlockReturn(CodegenExpressionBuilder.ConstantNull())

                             .MethodReturn(
                    CodegenExpressionBuilder.Op(
                        CodegenExpressionBuilder.Ref("i1"),
                        "/",
                        CodegenExpressionBuilder.Ref("i2")));

                return(CodegenExpressionBuilder.LocalMethod(
                           method,
                           CodegenAsInt(left, ltype),
                           CodegenAsInt(right, rtype)));
            }
示例#6
0
        private CodegenExpression BuildMap<T>(IDictionary<string, T> map)
        {
            if (map == null) {
                return ConstantNull();
            }

            if (map.IsEmpty()) {
                return StaticMethod(typeof(Collections), "GetEmptyMap", new Type[] { typeof(string), typeof(T) });
            }

            if (map.Count == 1) {
                var single = map.First();
                return StaticMethod(
                    typeof(Collections),
                    "SingletonMap",
                    new Type[] { typeof(string), typeof(T) },
                    CodegenExpressionBuilder.Constant(single.Key),
                    BuildMapValue(single.Value));
            }

            var child = method.MakeChild(typeof(IDictionary<string, T>), originator, classScope);
            child.Block.DeclareVar<IDictionary<string, T>>(
                "map",
                NewInstance(typeof(LinkedHashMap<string, T>)));
            foreach (var entry in map) {
                child.Block.ExprDotMethod(
                    Ref("map"),
                    "Put",
                    CodegenExpressionBuilder.Constant(entry.Key),
                    BuildMapValue(entry.Value));
            }

            return LocalMethod(child);
        }
示例#7
0
 private CodegenMethod GetCodegen(
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope)
 {
     return codegenMethodScope.MakeChild(typeof(object), GetType(), codegenClassScope)
         .AddParam(typeof(GenericRecord), "record")
         .Block
         .DeclareVar<GenericRecord>(
             "inner",
             CodegenExpressionBuilder.Cast(
                 typeof(GenericRecord),
                 CodegenExpressionBuilder.StaticMethod(
                     typeof(GenericRecordExtensions),
                     "Get",
                     CodegenExpressionBuilder.Ref("record"),
                     CodegenExpressionBuilder.Constant(_fieldTop))))
         .MethodReturn(
             CodegenExpressionBuilder.Conditional(
                 CodegenExpressionBuilder.EqualsNull(CodegenExpressionBuilder.Ref("inner")),
                 CodegenExpressionBuilder.ConstantNull(),
                 _getter.UnderlyingGetCodegen(
                     CodegenExpressionBuilder.Ref("inner"),
                     codegenMethodScope,
                     codegenClassScope)));
 }
 private CodegenMethod GetCodegen(
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope)
 {
     return codegenMethodScope.MakeChild(typeof(object), GetType(), codegenClassScope)
         .AddParam(typeof(GenericRecord), "record")
         .Block
         .DeclareVar<GenericRecord>(
             "inner",
             CodegenExpressionBuilder.Cast(
                 typeof(GenericRecord),
                 CodegenExpressionBuilder.StaticMethod(
                     typeof(GenericRecordExtensions),
                     "Get",
                     CodegenExpressionBuilder.Ref("record"),
                     CodegenExpressionBuilder.Constant(_top.Name))))
         .IfRefNullReturnNull("inner")
         .DeclareVar<object>(
             "collection",
             CodegenExpressionBuilder.StaticMethod(
                 typeof(GenericRecordExtensions),
                 "Get",
                 CodegenExpressionBuilder.Ref("inner"),
                 CodegenExpressionBuilder.Constant(_pos)))
         .MethodReturn(
             CodegenExpressionBuilder.StaticMethod(
                 typeof(AvroEventBeanGetterIndexed),
                 "GetAvroIndexedValue",
                 CodegenExpressionBuilder.Ref("collection"),
                 CodegenExpressionBuilder.Constant(_index)));
 }
            public CodegenExpression EvaluateCodegen(
                Type requiredType,
                CodegenMethodScope codegenMethodScope,
                ExprForgeCodegenSymbol exprSymbol,
                CodegenClassScope codegenClassScope)
            {
                var methodNode = codegenMethodScope.MakeChild(
                    typeof(object),
                    typeof(ExprForgeStreamWithGetter),
                    codegenClassScope);
                var refEPS = exprSymbol.GetAddEPS(methodNode);

                methodNode.Block
                .DeclareVar <EventBean>(
                    "theEvent",
                    CodegenExpressionBuilder.ArrayAtIndex(refEPS, CodegenExpressionBuilder.Constant(0)))
                .IfRefNotNull("theEvent")
                .BlockReturn(
                    getter.EventBeanGetCodegen(
                        CodegenExpressionBuilder.Ref("theEvent"),
                        methodNode,
                        codegenClassScope))
                .MethodReturn(CodegenExpressionBuilder.ConstantNull());
                return(CodegenExpressionBuilder.LocalMethod(methodNode));
            }
示例#10
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();
 }
示例#11
0
 private CodegenMethod GetAvroFieldExistsCodegen(
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope)
 {
     return codegenMethodScope
         .MakeChild(typeof(bool), GetType(), codegenClassScope)
         .AddParam(typeof(GenericRecord), "record")
         .Block
         .DeclareVar<IDictionary<string, object>>(
             "values",
             CodegenExpressionBuilder.StaticMethod(
                 typeof(CompatExtensions),
                 "AsStringDictionary",
                 CodegenExpressionBuilder.StaticMethod(
                     typeof(GenericRecordExtensions),
                     "Get",
                     CodegenExpressionBuilder.Ref("record"),
                     CodegenExpressionBuilder.Constant(_pos.Name))))
         .IfRefNullReturnFalse("values")
         .MethodReturn(
             CodegenExpressionBuilder.ExprDotMethod(
                 CodegenExpressionBuilder.Ref("values"),
                 "ContainsKey",
                 CodegenExpressionBuilder.Constant(_key)));
 }
 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();
 }
        public CodegenExpression MakeCodegen(
            CodegenClassScope classScope,
            CodegenMethodScope parent)
        {
            var getterSPI = ((EventTypeSPI) _eventType).GetGetterSPI(ResultEventProperty);
            var method = parent.MakeChild(typeof(object), GetType(), classScope)
				.AddParam(GET_FILTER_VALUE_FP);
            method.Block
                .DeclareVar<EventBean[]>(
                    "events",
                    Cast(
                        typeof(EventBean[]),
                        ExprDotMethod(
                            Ref("matchedEvents"),
                            "GetMatchingEventAsObjectByTag",
                            CodegenExpressionBuilder.Constant(ResultEventAsName))))
                .DeclareVar<object>("value", ConstantNull())
                .IfRefNotNull("events")
                .AssignRef(
                    "value",
                    getterSPI.EventBeanGetCodegen(
                        ArrayAtIndex(Ref("events"), CodegenExpressionBuilder.Constant(_resultEventIndex)),
                        method,
                        classScope))
                .BlockEnd();

            if (_isMustCoerce) {
                method.Block.AssignRef(
                    "value",
                    TypeHelper.CoerceNumberToBoxedCodegen(Ref("value"), typeof(object), ReturnType));
            }

            method.Block.MethodReturn(Ref("value"));
            return LocalMethod(method, GET_FILTER_VALUE_REFS);
        }
示例#14
0
 private CodegenMethod GetCodegen(
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope)
 {
     return codegenMethodScope.MakeChild(typeof(object), GetType(), codegenClassScope)
         .AddParam(typeof(GenericRecord), "record")
         .Block
         .DeclareVar<GenericRecord>(
             "inner",
             CodegenExpressionBuilder.Cast(
                 typeof(GenericRecord),
                 CodegenExpressionBuilder.StaticMethod(
                     typeof(GenericRecordExtensions),
                     "Get",
                     CodegenExpressionBuilder.Ref("record"),
                     CodegenExpressionBuilder.Constant(_top.Name))))
         .IfRefNullReturnNull("inner")
         .DeclareVar<IDictionary<string, object>>(
             "map",
             CodegenLegoCast.CastSafeFromObjectType(
                 typeof(IDictionary<string, object>),
                 CodegenExpressionBuilder.StaticMethod(
                     typeof(GenericRecordExtensions),
                     "Get",
                     CodegenExpressionBuilder.Ref("inner"),
                     CodegenExpressionBuilder.Constant(_pos.Name))))
         .MethodReturn(
             CodegenExpressionBuilder.StaticMethod(
                 typeof(AvroEventBeanGetterMapped),
                 "GetAvroMappedValueWNullCheck",
                 CodegenExpressionBuilder.Ref("map"),
                 CodegenExpressionBuilder.Constant(_key)));
 }
            public static CodegenExpression Codegen(
                IntervalComputerFinishedByThresholdForge forge,
                CodegenExpression leftStart,
                CodegenExpression leftEnd,
                CodegenExpression rightStart,
                CodegenExpression rightEnd,
                CodegenMethodScope codegenMethodScope,
                ExprForgeCodegenSymbol exprSymbol,
                CodegenClassScope codegenClassScope)
            {
                var methodNode = codegenMethodScope.MakeChild(
                    typeof(bool?),
                    typeof(IntervalComputerFinishedByThresholdEval),
                    codegenClassScope)
                                 .AddParam(IntervalForgeCodegenNames.PARAMS);

                methodNode.Block
                .DeclareVar <long>(
                    "threshold",
                    forge.thresholdExpr.Codegen(
                        CodegenExpressionBuilder.StaticMethod(
                            typeof(Math),
                            "Min",
                            IntervalForgeCodegenNames.REF_RIGHTEND,
                            IntervalForgeCodegenNames.REF_LEFTEND),
                        methodNode,
                        exprSymbol,
                        codegenClassScope))
                .IfCondition(
                    CodegenExpressionBuilder.Relational(
                        CodegenExpressionBuilder.Ref("threshold"),
                        CodegenExpressionRelational.CodegenRelational.LT,
                        CodegenExpressionBuilder.Constant(0)))
                .StaticMethod(
                    typeof(IntervalComputerFinishedByThresholdEval),
                    METHOD_LOGWARNINGINTERVALFINISHEDBYTHRESHOLD)
                .BlockReturn(CodegenExpressionBuilder.ConstantNull())
                .IfConditionReturnConst(
                    CodegenExpressionBuilder.Relational(
                        IntervalForgeCodegenNames.REF_LEFTSTART,
                        CodegenExpressionRelational.CodegenRelational.GE,
                        IntervalForgeCodegenNames.REF_RIGHTSTART),
                    false)
                .DeclareVar <long>(
                    "delta",
                    CodegenExpressionBuilder.StaticMethod(
                        typeof(Math),
                        "Abs",
                        CodegenExpressionBuilder.Op(
                            IntervalForgeCodegenNames.REF_LEFTEND,
                            "-",
                            IntervalForgeCodegenNames.REF_RIGHTEND)))
                .MethodReturn(
                    CodegenExpressionBuilder.Relational(
                        CodegenExpressionBuilder.Ref("delta"),
                        CodegenExpressionRelational.CodegenRelational.LE,
                        CodegenExpressionBuilder.Ref("threshold")));
                return(CodegenExpressionBuilder.LocalMethod(methodNode, leftStart, leftEnd, rightStart, rightEnd));
            }
            public CodegenExpression Codegen(
                CodegenMethodScope codegenMethodScope,
                CodegenClassScope codegenClassScope,
                CodegenExpressionRef left,
                CodegenExpressionRef right,
                Type ltype,
                Type rtype)
            {
                var resultType = typeof(decimal);

                if (ltype.IsNullable() || rtype.IsNullable() || _divisionByZeroReturnsNull)
                {
                    resultType = typeof(decimal?);
                }

                var block = codegenMethodScope
                            .MakeChild(resultType, typeof(DivideDecimalConvComputerBase), codegenClassScope)
                            .AddParam(ltype, "d1")
                            .AddParam(rtype, "d2")
                            .Block
                            .DeclareVar <decimal>(
                    "s1",
                    _convOne.CoerceCodegen(CodegenExpressionBuilder.Ref("d1"), ltype))
                            .DeclareVar <decimal>(
                    "s2",
                    _convTwo.CoerceCodegen(CodegenExpressionBuilder.Ref("d2"), rtype));
                var ifZeroDivisor =
                    block.IfCondition(
                        CodegenExpressionBuilder.EqualsIdentity(
                            CodegenExpressionBuilder.Ref("s2"),
                            CodegenExpressionBuilder.Constant(0.0m)));

                if (_divisionByZeroReturnsNull)
                {
                    ifZeroDivisor.BlockReturn(CodegenExpressionBuilder.ConstantNull());
                }
                else
                {
                    ifZeroDivisor.DeclareVar <decimal>(
                        "result",
                        CodegenExpressionBuilder.Op(
                            CodegenExpressionBuilder.Ref("s1"),
                            "/",
                            CodegenExpressionBuilder.Constant(0.0m)))
                    .BlockReturn(CodegenExpressionBuilder.Ref("result"));
                }

                var method = block.MethodReturn(
                    DoDivideCodegen(
                        CodegenExpressionBuilder.Ref("s1"),
                        CodegenExpressionBuilder.Ref("s2"),
                        codegenClassScope));

                return(CodegenExpressionBuilder
                       .LocalMethodBuild(method)
                       .Pass(left)
                       .Pass(right)
                       .Call());
            }
示例#17
0
        private CodegenExpression BuildMapValue(object value)
        {
            if (value is IDictionary<string, object>) {
                return BuildMap((IDictionary<string, object>) value);
            }

            return CodegenExpressionBuilder.Constant(value);
        }
示例#18
0
 public static CodegenExpression ResolveMethodCodegenExactNonStatic(MethodInfo method)
 {
     return(CodegenExpressionBuilder.StaticMethod(
                typeof(MethodResolver),
                "ResolveMethodExactNonStatic",
                CodegenExpressionBuilder.Constant(method.DeclaringType),
                CodegenExpressionBuilder.Constant(method.Name),
                CodegenExpressionBuilder.Constant(method.GetParameterTypes())));
 }
示例#19
0
 public CodegenExpression Codegen(
     CodegenMethod method,
     CodegenClassScope classScope,
     CodegenExpression typeInitSvcRef)
 {
     return(CodegenExpressionBuilder.NewInstance <ClassMultiValuedEPType>(
                CodegenExpressionBuilder.Constant(Container),
                CodegenExpressionBuilder.Constant(Component)));
 }
示例#20
0
 public CodegenExpression Codegen(
     CodegenMethod method,
     CodegenClassScope classScope,
     CodegenExpression typeInitSvcRef)
 {
     return(CodegenExpressionBuilder.NewInstance <EventMultiValuedEPType>(
                CodegenExpressionBuilder.Constant(Container),
                EventTypeUtility.ResolveTypeCodegen(Component, typeInitSvcRef)));
 }
            public static CodegenExpression Codegen(
                IntervalComputerOverlapsAndByThreshold forge,
                CodegenExpression leftStart,
                CodegenExpression leftEnd,
                CodegenExpression rightStart,
                CodegenExpression rightEnd,
                CodegenMethodScope codegenMethodScope,
                ExprForgeCodegenSymbol exprSymbol,
                CodegenClassScope codegenClassScope)
            {
                var methodNode = codegenMethodScope.MakeChild(
                    typeof(bool),
                    typeof(IntervalComputerOverlapsAndByThresholdEval),
                    codegenClassScope)
                                 .AddParam(IntervalForgeCodegenNames.PARAMS);

                var block = methodNode.Block
                            .DeclareVar <long>(
                    "threshold",
                    forge.thresholdExpr.Codegen(
                        forge.overlaps
                                ? IntervalForgeCodegenNames.REF_LEFTSTART
                                : IntervalForgeCodegenNames.REF_RIGHTSTART,
                        methodNode,
                        exprSymbol,
                        codegenClassScope));

                if (forge.overlaps)
                {
                    block.MethodReturn(
                        CodegenExpressionBuilder.StaticMethod(
                            typeof(IntervalComputerOverlapsAndByThresholdEval),
                            "ComputeIntervalOverlaps",
                            IntervalForgeCodegenNames.REF_LEFTSTART,
                            IntervalForgeCodegenNames.REF_LEFTEND,
                            IntervalForgeCodegenNames.REF_RIGHTSTART,
                            IntervalForgeCodegenNames.REF_RIGHTEND,
                            CodegenExpressionBuilder.Constant(0),
                            CodegenExpressionBuilder.Ref("threshold")));
                }
                else
                {
                    block.MethodReturn(
                        CodegenExpressionBuilder.StaticMethod(
                            typeof(IntervalComputerOverlapsAndByThresholdEval),
                            "ComputeIntervalOverlaps",
                            IntervalForgeCodegenNames.REF_RIGHTSTART,
                            IntervalForgeCodegenNames.REF_RIGHTEND,
                            IntervalForgeCodegenNames.REF_LEFTSTART,
                            IntervalForgeCodegenNames.REF_LEFTEND,
                            CodegenExpressionBuilder.Constant(0),
                            CodegenExpressionBuilder.Ref("threshold")));
                }

                return(CodegenExpressionBuilder.LocalMethod(methodNode, leftStart, leftEnd, rightStart, rightEnd));
            }
示例#22
0
        public SAIFFInitializeBuilder Constant(
            string name,
            object value)
        {
            if (value is CodegenExpression) {
                throw new ArgumentException("Expected a non-expression value, received " + value);
            }

            return SetValue(name, value == null ? ConstantNull() : CodegenExpressionBuilder.Constant(value));
        }
示例#23
0
 internal CodegenExpression CodegenFormatter(CodegenClassScope codegenClassScope)
 {
     return(codegenClassScope.AddDefaultFieldUnshared(
                true,
                typeof(DateTimeFormat),
                CodegenExpressionBuilder.StaticMethod(
                    typeof(DateTimeFormat),
                    "For",
                    CodegenExpressionBuilder.Constant(format))));
 }
示例#24
0
 public CodegenExpression UnderlyingExistsCodegen(
     CodegenExpression underlyingExpression,
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope)
 {
     return CodegenExpressionBuilder.NotEqualsNull(
         CodegenExpressionBuilder.ExprDotMethodChain(underlyingExpression)
             .Get("Schema")
             .Add("GetField", CodegenExpressionBuilder.Constant(_propertyName)));
 }
 public static CodegenExpression CodegenComparable(
     CodegenExpression lhs,
     CodegenExpression rhs,
     CodegenExpressionRelational.CodegenRelational rel)
 {
     return(CodegenExpressionBuilder.Relational(
                CodegenExpressionBuilder.ExprDotMethod(lhs, "CompareTo", rhs),
                rel,
                CodegenExpressionBuilder.Constant(0)));
 }
示例#26
0
        public CodegenSetterBuilder MapOfConstants <T>(
            string name,
            IDictionary <string, T> values)
        {
            CodegenSetterBuilderItemConsumer <T> consumer = (
                o,
                parent,
                scope) => CodegenExpressionBuilder.Constant(o);

            return(SetValue(name, BuildMap(values, consumer, _originator, _method, _classScope)));
        }
示例#27
0
 public CodegenExpression UnderlyingExistsCodegen(
     CodegenExpression underlyingExpression,
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope)
 {
     return CodegenExpressionBuilder.StaticMethod(
         GetType(),
         "IsAvroFieldExists",
         underlyingExpression,
         CodegenExpressionBuilder.Constant(_propertyName));
 }
示例#28
0
 public CodegenExpression UnderlyingGetCodegen(
     CodegenExpression underlyingExpression,
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope)
 {
     return CodegenExpressionBuilder.StaticMethod(
         typeof(GenericRecordExtensions),
         "Get",
         underlyingExpression,
         CodegenExpressionBuilder.Constant(_propertyName));
 }
 public static CodegenExpression CodegenStringCompare(
     CodegenExpression lhs,
     Type lhsType,
     CodegenExpression rhs,
     Type rhsType,
     CodegenExpressionRelational.CodegenRelational rel)
 {
     return(CodegenExpressionBuilder.Relational(
                CodegenExpressionBuilder.ExprDotMethod(CodegenAsString(lhs, lhsType), "CompareTo", CodegenAsString(rhs, rhsType)),
                rel,
                CodegenExpressionBuilder.Constant(0)));
 }
示例#30
0
 public CodegenExpression UnderlyingGetCodegen(
     CodegenExpression underlyingExpression,
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope)
 {
     return CodegenExpressionBuilder.StaticMethod(
         GetType(),
         "GetAvroFieldValue",
         underlyingExpression,
         CodegenExpressionBuilder.Constant(_propertyName),
         CodegenExpressionBuilder.Constant(_index));
 }