当前位置: 首页>>代码示例>>Java>>正文


Java ExprDotStaticMethodWrapFactory类代码示例

本文整理汇总了Java中com.espertech.esper.epl.enummethod.dot.ExprDotStaticMethodWrapFactory的典型用法代码示例。如果您正苦于以下问题:Java ExprDotStaticMethodWrapFactory类的具体用法?Java ExprDotStaticMethodWrapFactory怎么用?Java ExprDotStaticMethodWrapFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExprDotStaticMethodWrapFactory类属于com.espertech.esper.epl.enummethod.dot包,在下文中一共展示了ExprDotStaticMethodWrapFactory类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validate

import com.espertech.esper.epl.enummethod.dot.ExprDotStaticMethodWrapFactory; //导入依赖的package包/类
public ExprNode validate(ExprValidationContext validationContext) throws ExprValidationException {
    ExprNodeUtilityRich.validate(ExprNodeOrigin.PLUGINSINGLEROWPARAM, chainSpec, validationContext);

    // get first chain item
    List<ExprChainedSpec> chainList = new ArrayList<ExprChainedSpec>(chainSpec);
    ExprChainedSpec firstItem = chainList.remove(0);

    // Get the types of the parameters for the first invocation
    boolean allowWildcard = validationContext.getStreamTypeService().getEventTypes().length == 1;
    EventType streamZeroType = null;
    if (validationContext.getStreamTypeService().getEventTypes().length > 0) {
        streamZeroType = validationContext.getStreamTypeService().getEventTypes()[0];
    }
    final ExprNodeUtilMethodDesc staticMethodDesc = ExprNodeUtilityRich.resolveMethodAllowWildcardAndStream(clazz.getName(), null, firstItem.getName(), firstItem.getParameters(), validationContext.getEngineImportService(), validationContext.getEventAdapterService(), validationContext.getStatementId(), allowWildcard, streamZeroType, new ExprNodeUtilResolveExceptionHandlerDefault(firstItem.getName(), true), functionName, validationContext.getTableService(), validationContext.getStreamTypeService().getEngineURIQualifier());

    boolean allowValueCache = true;
    boolean isReturnsConstantResult;
    if (config.getValueCache() == ConfigurationPlugInSingleRowFunction.ValueCache.DISABLED) {
        isReturnsConstantResult = false;
        allowValueCache = false;
    } else if (config.getValueCache() == ConfigurationPlugInSingleRowFunction.ValueCache.CONFIGURED) {
        isReturnsConstantResult = validationContext.getEngineImportService().isUdfCache() && staticMethodDesc.isAllConstants() && chainList.isEmpty();
        allowValueCache = validationContext.getEngineImportService().isUdfCache();
    } else if (config.getValueCache() == ConfigurationPlugInSingleRowFunction.ValueCache.ENABLED) {
        isReturnsConstantResult = staticMethodDesc.isAllConstants() && chainList.isEmpty();
    } else {
        throw new IllegalStateException("Invalid value cache code " + config.getValueCache());
    }

    // this may return a pair of null if there is no lambda or the result cannot be wrapped for lambda-function use
    ExprDotStaticMethodWrap optionalLambdaWrap = ExprDotStaticMethodWrapFactory.make(staticMethodDesc.getReflectionMethod(), validationContext.getEventAdapterService(), chainList, config.getOptionalEventTypeName());
    EPType typeInfo = optionalLambdaWrap != null ? optionalLambdaWrap.getTypeInfo() : EPTypeHelper.singleValue(staticMethodDesc.getReflectionMethod().getReturnType());

    ExprDotForge[] eval = ExprDotNodeUtility.getChainEvaluators(-1, typeInfo, chainList, validationContext, false, new ExprDotNodeFilterAnalyzerInputStatic()).getChainWithUnpack();
    ExprDotNodeForgeStaticMethod staticMethodForge = new ExprDotNodeForgeStaticMethod(this, isReturnsConstantResult, validationContext.getStatementName(), clazz.getName(), staticMethodDesc.getFastMethod(), staticMethodDesc.getChildForges(), allowValueCache && staticMethodDesc.isAllConstants(), eval, optionalLambdaWrap, config.isRethrowExceptions(), null);

    // If caching the result, evaluate now and return the result.
    if (isReturnsConstantResult) {
        final Object result = staticMethodForge.getExprEvaluator().evaluate(null, true, null);
        forge = new ExprPlugInSingleRowNodeForgeConst(this, result, staticMethodDesc.getReflectionMethod());
    } else {
        forge = new ExprPlugInSingleRowNodeForgeNC(this, staticMethodForge);
    }
    return null;
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:46,代码来源:ExprPlugInSingleRowNode.java

示例2: validate

import com.espertech.esper.epl.enummethod.dot.ExprDotStaticMethodWrapFactory; //导入依赖的package包/类
public void validate(ExprValidationContext validationContext) throws ExprValidationException
{
       ExprNodeUtility.validate(chainSpec, validationContext);

       // get first chain item
       List<ExprChainedSpec> chainList = new ArrayList<ExprChainedSpec>(chainSpec);
       ExprChainedSpec firstItem = chainList.remove(0);

	// Get the types of the parameters for the first invocation
       boolean allowWildcard = validationContext.getStreamTypeService().getEventTypes().length == 1;
       EventType streamZeroType = null;
       if (validationContext.getStreamTypeService().getEventTypes().length > 0) {
           streamZeroType = validationContext.getStreamTypeService().getEventTypes()[0];
       }
       final ExprNodeUtilSingleRowMethodDesc staticMethodDesc = ExprNodeUtility.resolveSingleRowPluginFunc(clazz.getName(), firstItem.getName(), firstItem.getParameters(), validationContext.getMethodResolutionService(), allowWildcard, streamZeroType, firstItem.getName(), true);

       boolean allowValueCache = true;
       if (config.getValueCache() == ConfigurationPlugInSingleRowFunction.ValueCache.DISABLED) {
           isReturnsConstantResult = false;
           allowValueCache = false;
       }
       else if (config.getValueCache() == ConfigurationPlugInSingleRowFunction.ValueCache.CONFIGURED) {
           isReturnsConstantResult = validationContext.getMethodResolutionService().isUdfCache() && staticMethodDesc.isAllConstants() && chainList.isEmpty();
           allowValueCache = validationContext.getMethodResolutionService().isUdfCache();
       }
       else if (config.getValueCache() == ConfigurationPlugInSingleRowFunction.ValueCache.ENABLED) {
           isReturnsConstantResult = staticMethodDesc.isAllConstants() && chainList.isEmpty();
       }
       else {
           throw new IllegalStateException("Invalid value cache code " + config.getValueCache());
       }

       // this may return a pair of null if there is no lambda or the result cannot be wrapped for lambda-function use
       ExprDotStaticMethodWrap optionalLambdaWrap = ExprDotStaticMethodWrapFactory.make(staticMethodDesc.getReflectionMethod(), validationContext.getEventAdapterService(), chainList);
       ExprDotEvalTypeInfo typeInfo = optionalLambdaWrap != null ? optionalLambdaWrap.getTypeInfo() : ExprDotEvalTypeInfo.scalarOrUnderlying(staticMethodDesc.getReflectionMethod().getReturnType());

       ExprDotEval[] eval = ExprDotNodeUtility.getChainEvaluators(typeInfo, chainList, validationContext, false, new ExprDotNodeFilterAnalyzerInputStatic()).getChainWithUnpack();
       evaluator = new ExprDotEvalStaticMethod(validationContext.getStatementName(), clazz.getName(), staticMethodDesc.getFastMethod(), staticMethodDesc.getChildEvals(), allowValueCache && staticMethodDesc.isAllConstants(), optionalLambdaWrap, eval, config.isRethrowExceptions());

       // If caching the result, evaluate now and return the result.
       if (isReturnsConstantResult) {
           final Object result = evaluator.evaluate(null, true, null);
           evaluator = new ExprEvaluator() {
               public Object evaluate(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext context) {
                   return result;
               }

               public Class getType() {
                   return staticMethodDesc.getFastMethod().getReturnType();
               }

               public Map<String, Object> getEventType() throws ExprValidationException {
                   return null;
               }
           };
       }
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:58,代码来源:ExprPlugInSingleRowNode.java


注:本文中的com.espertech.esper.epl.enummethod.dot.ExprDotStaticMethodWrapFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。