public static CodegenExpressionExprDotMethodChain exprDotMethodChain(CodegenExpression expression) { return new CodegenExpressionExprDotMethodChain(expression); }
public CodegenExpression codegen(CodegenExpression value, Class valueType, CodegenClassScope codegenClassScope) { if (valueType != LocalDateTime.class) { throw new IllegalStateException("Expected a LocalDateTime type"); } CodegenExpression timeZoneField = codegenClassScope.addOrGetFieldSharable(RuntimeSettingsTimeZoneField.INSTANCE); return exprDotMethodChain(value).add("atZone", exprDotMethod(timeZoneField, "toZoneId")).add("toInstant").add("toEpochMilli"); } }
public CodegenExpression initCtorScoped() { return exprDotMethodChain(EPStatementInitServices.REF).add(EPStatementInitServices.GETTIMEPROVIDER); } }
public CodegenExpression evaluateCodegenUninstrumented(Class requiredType, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { CodegenExpressionRef refExprEvalCtx = exprSymbol.getAddExprEvalCtx(codegenMethodScope); return exprDotMethodChain(refExprEvalCtx).add("getTimeProvider").add("getTime"); }
public CodegenExpression initCtorScoped() { return exprDotMethodChain(EPStatementInitServices.REF).add(EPStatementInitServices.GETRESULTSETPROCESSORHELPERFACTORY); } }
public static CodegenExpression resolveTypeCodegen(EventType eventType, CodegenExpression initServicesRef) { if (eventType == null) { throw new IllegalArgumentException("Null event type"); } if (eventType instanceof BeanEventType && eventType.getMetadata().getAccessModifier() == NameAccessModifier.TRANSIENT) { return exprDotMethodChain(initServicesRef).add(EPStatementInitServices.GETEVENTTYPERESOLVER).add(EventTypeResolver.RESOLVE_PRIVATE_BEAN_METHOD, constant(eventType.getUnderlyingType())); } return exprDotMethodChain(initServicesRef).add(EPStatementInitServices.GETEVENTTYPERESOLVER).add(EventTypeResolver.RESOLVE_METHOD, eventType.getMetadata().toExpression()); }
public CodegenExpression eventBeanGetCodegen(CodegenExpression beanExpression, CodegenMethodScope parent, CodegenClassScope classScope) { CodegenMethod method = parent.makeChild(String.class, this.getClass(), classScope).addParam(EventBean.class, "bean"); method.getBlock().methodReturn(exprDotMethodChain(ref("bean")).add("getEventType").add("getName")); return localMethod(method, beanExpression); } };
private CodegenExpression codegenLDTZDT(CodegenExpression val, Class type) { CodegenExpression chronoUnit = enumValue(ChronoUnit.class, fieldName.getChronoUnit().name()); if (code == ApacheCommonsDateUtils.MODIFY_TRUNCATE) { return exprDotMethod(val, "truncatedTo", chronoUnit); } else if (code == ApacheCommonsDateUtils.MODIFY_CEILING) { return exprDotMethodChain(val).add("plus", constant(1), chronoUnit).add("truncatedTo", chronoUnit); } else { throw new EPException("Round-half operation not supported for " + type.getSimpleName()); } } }
private static CodegenMethod registerScriptCodegen(Map.Entry<NameAndParamNum, ExpressionScriptProvided> script, CodegenMethodScope parent, CodegenClassScope classScope, ModuleScriptInitializeSymbol symbols) { CodegenMethod method = parent.makeChild(void.class, EPCompilerImpl.class, classScope); method.getBlock() .expression(exprDotMethodChain(symbols.getAddInitSvc(method)).add(EPModuleScriptInitServices.GETSCRIPTCOLLECTOR) .add("registerScript", constant(script.getKey().getName()), constant(script.getKey().getParamNum()), script.getValue().make(method, classScope))); return method; }
public CodegenExpression make(CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { // resolve variable at init-time via field CodegenExpression variableExpression = constantNull(); if (variableMetaData != null) { variableExpression = VariableDeployTimeResolver.makeVariableField(variableMetaData, classScope, this.getClass()); } CodegenMethod method = parent.makeChild(OutputConditionFactory.class, this.getClass(), classScope); method.getBlock() .methodReturn(exprDotMethodChain(symbols.getAddInitSvc(method)).add(EPStatementInitServices.GETRESULTSETPROCESSORHELPERFACTORY) .add("makeOutputConditionCount", constant(eventRate), variableExpression)); return localMethod(method); }
private static CodegenMethod registerTableCodegen(Map.Entry<String, TableMetaData> table, CodegenMethodScope parent, CodegenClassScope classScope, ModuleTableInitializeSymbol symbols) { CodegenMethod method = parent.makeChild(void.class, EPCompilerImpl.class, classScope); method.getBlock() .declareVar(TableMetaData.class, "detail", table.getValue().make(parent, symbols, classScope)) .expression(exprDotMethodChain(symbols.getAddInitSvc(method)).add(EPModuleTableInitServices.GETTABLECOLLECTOR).add("registerTable", constant(table.getKey()), ref("detail"))); return method; }