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


Java VariableResolverFactory.createVariable方法代码示例

本文整理汇总了Java中org.mvel2.integration.VariableResolverFactory.createVariable方法的典型用法代码示例。如果您正苦于以下问题:Java VariableResolverFactory.createVariable方法的具体用法?Java VariableResolverFactory.createVariable怎么用?Java VariableResolverFactory.createVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mvel2.integration.VariableResolverFactory的用法示例。


在下文中一共展示了VariableResolverFactory.createVariable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getReducedValueAccelerated

import org.mvel2.integration.VariableResolverFactory; //导入方法依赖的package包/类
public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
    if (accExpr == null) {
        accExpr = (CompiledAccExpression) compileSetExpression(indexTarget);
    }

    if (col) {
        return accExpr.setValue(ctx, thisValue, factory, statement.getValue(ctx, thisValue, factory));
    }
    else if (statement != null) {
        return factory.createVariable(varName, statement.getValue(ctx, thisValue, factory)).getValue();
    }
    else {
        factory.createVariable(varName, null);
        return null;
    }
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:17,代码来源:AssignmentNode.java

示例2: testThisReferenceMapVirtualObjects1

import org.mvel2.integration.VariableResolverFactory; //导入方法依赖的package包/类
public void testThisReferenceMapVirtualObjects1() {
    // Create our root Map object
    Map<String, String> map = new HashMap<String, String>();
    map.put("foo", "bar");

    VariableResolverFactory factory = new MapVariableResolverFactory(new HashMap<String, Object>());
    factory.createVariable("this", map);

    OptimizerFactory.setDefaultOptimizer("reflective");

    // Run test
    assertEquals(true,
            executeExpression(compileExpression("this.foo == 'bar'"),
                    map,
                    factory));
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:17,代码来源:CoreConfidenceTests.java

示例3: testThisReferenceMapVirtualObjects2

import org.mvel2.integration.VariableResolverFactory; //导入方法依赖的package包/类
public void testThisReferenceMapVirtualObjects2() {
    // Create our root Map object
    Map<String, String> map = new HashMap<String, String>();
    map.put("foo",
            "bar");

    VariableResolverFactory factory = new MapVariableResolverFactory(new HashMap<String, Object>());
    factory.createVariable("this",
            map);

    // I think we can all figure this one out.

    if (!Boolean.getBoolean("mvel2.disable.jit")) OptimizerFactory.setDefaultOptimizer("ASM");

    // Run test
    assertEquals(true,
            executeExpression(compileExpression("this.foo == 'bar'"),
                    map,
                    factory));
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:21,代码来源:CoreConfidenceTests.java

示例4: createProcessVariableResolver

import org.mvel2.integration.VariableResolverFactory; //导入方法依赖的package包/类
private VariableResolverFactory createProcessVariableResolver(JoinPoint pjp) {
    VariableResolverFactory variableResolverFactory = new MapVariableResolverFactory();
    Utils.fillResolveParams(aspect.getProcess().getResultParams(), variableResolverFactory);
    variableResolverFactory.createVariable(JOIN_POINT_VARIABLE, pjp);
    variableResolverFactory.createVariable(ContextUtils.VARIABLE_RESOLVER, variableResolverFactory);
    variableResolverFactory.setNextFactory(resolverFactory);
    return variableResolverFactory;
}
 
开发者ID:igor-suhorukov,项目名称:aspectj-scripting,代码行数:9,代码来源:BaseAspectLifecycle.java

示例5: loadArtifact

import org.mvel2.integration.VariableResolverFactory; //导入方法依赖的package包/类
public static void loadArtifact(Artifact[] artifacts, VariableResolverFactory variableResolverFactory) {
    if(artifacts!=null){
        for(Artifact artifact: artifacts){
            URLClassLoader classLoader = getClassLoader(artifact.getArtifact());
            ClassRef[] classRefs = artifact.getClassRefs();
            if(classRefs!=null){
                for(ClassRef classRef: classRefs){
                    String className = classRef.getClassName();
                    try {
                        Class<?> aClass = classLoader.loadClass(className);
                        variableResolverFactory.createVariable(classRef.getVariable(), aClass);
                        variableResolverFactory.createVariable(className, aClass);//fix MVEL class resolution
                    } catch (ClassNotFoundException e) {
                        throw new IllegalArgumentException("Class '"+ className
                                +"' not found in artifact: "+artifact.getArtifact());
                    }
                }
            }
            ResourceRef[] resourceRefs = artifact.getResourceRefs();
            if(resourceRefs!=null){
                for(ResourceRef resourceRef: resourceRefs){
                    Object resourceStream;
                    if(resourceRef.isUseUrl()){
                        resourceStream = classLoader.getResource(resourceRef.getResourceName());
                    } else {
                        resourceStream = classLoader.getResourceAsStream(resourceRef.getResourceName());
                    }
                    if (resourceStream == null) {
                        throw new IllegalArgumentException("Resource " + resourceRef.getResourceName() +
                                " not found in artifact: " + artifact.getArtifact());
                    }
                    variableResolverFactory.createVariable(resourceRef.getVariable(), resourceStream);
                }
            }
        }
    }
}
 
开发者ID:igor-suhorukov,项目名称:aspectj-scripting,代码行数:38,代码来源:MavenLoader.java

示例6: fillResolveParams

import org.mvel2.integration.VariableResolverFactory; //导入方法依赖的package包/类
public static void fillResolveParams(Map<String, Object> resultParams, VariableResolverFactory resolverFactory1) {
    if(resultParams!=null && resultParams.size()>0){
        for(Map.Entry<String,Object> entry: resultParams.entrySet()){
            resolverFactory1.createVariable(entry.getKey(), entry.getValue());
        }
    }
}
 
开发者ID:igor-suhorukov,项目名称:aspectj-scripting,代码行数:8,代码来源:Utils.java

示例7: getReducedValueAccelerated

import org.mvel2.integration.VariableResolverFactory; //导入方法依赖的package包/类
public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
    if (accExpr == null) {
        accExpr = (CompiledAccExpression) compileSetExpression(indexTarget);
    }

    if (col) {
        accExpr.setValue(ctx, thisValue, factory, ctx = statement.getValue(ctx, thisValue, factory));
    }
    else if (statement != null) {
        if (factory.isIndexedFactory()) {
            factory.createIndexedVariable(register, name, ctx = statement.getValue(ctx, thisValue, factory));
        }
        else {
            factory.createVariable(name, ctx = statement.getValue(ctx, thisValue, factory));
        }
    }
    else {
        if (factory.isIndexedFactory()) {
            factory.createIndexedVariable(register, name, null);
        }
        else {
            factory.createVariable(name, statement.getValue(ctx, thisValue, factory));
        }
        return Void.class;
    }

    return ctx;
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:29,代码来源:IndexedAssignmentNode.java

示例8: getReducedValueAccelerated

import org.mvel2.integration.VariableResolverFactory; //导入方法依赖的package包/类
public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
    if (name != null) {
        if (factory.isResolveable(name)) throw new CompileException("duplicate function: " + name);
        factory.createVariable(name, this);
    }
    return this;
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:8,代码来源:Function.java

示例9: getReducedValue

import org.mvel2.integration.VariableResolverFactory; //导入方法依赖的package包/类
public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) {
    if (name != null) {
        if (factory.isResolveable(name)) throw new CompileException("duplicate function: " + name);
        factory.createVariable(name, this);
    }
    return this;
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:8,代码来源:Function.java

示例10: testThisReferenceMapVirtualObjects

import org.mvel2.integration.VariableResolverFactory; //导入方法依赖的package包/类
public void testThisReferenceMapVirtualObjects() {
    Map<String, String> map = new HashMap<String, String>();
    map.put("foo",
            "bar");

    VariableResolverFactory factory = new MapVariableResolverFactory(new HashMap<String, Object>());
    factory.createVariable("this", map);

    assertEquals(true,
            eval("this.foo == 'bar'", map, factory));
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:12,代码来源:CoreConfidenceTests.java

示例11: executeProcessWithException

import org.mvel2.integration.VariableResolverFactory; //导入方法依赖的package包/类
protected void executeProcessWithException(JoinPoint joinPoint, Throwable exception) throws Throwable {
    if(processScript ==null) return;
    VariableResolverFactory variableResolverFactory = createProcessVariableResolver(joinPoint);
    variableResolverFactory.createVariable("exception", exception);
    Utils.executeMvelExpression(processScript, variableResolverFactory);
}
 
开发者ID:igor-suhorukov,项目名称:aspectj-scripting,代码行数:7,代码来源:BaseAspectLifecycle.java

示例12: getReducedValueAccelerated

import org.mvel2.integration.VariableResolverFactory; //导入方法依赖的package包/类
public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
    if (!factory.isResolveable(name)) factory.createVariable(name, null, egressType);
    else throw new CompileException("variable defined within scope: " + name);
    return null;
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:6,代码来源:DeclTypedVarNode.java

示例13: getReducedValue

import org.mvel2.integration.VariableResolverFactory; //导入方法依赖的package包/类
public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) {
    if (!factory.isResolveable(name)) factory.createVariable(name, null, egressType);
    else throw new CompileException("variable defined within scope: " + name);

    return null;
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:7,代码来源:DeclTypedVarNode.java

示例14: getReducedValue

import org.mvel2.integration.VariableResolverFactory; //导入方法依赖的package包/类
public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) {
    factory.createVariable(name, ctx = eval(stmt, thisValue, factory), egressType);
    return ctx;
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:5,代码来源:ProtoVarNode.java

示例15: getReducedValue

import org.mvel2.integration.VariableResolverFactory; //导入方法依赖的package包/类
@Override
public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) {
    factory.createVariable(name, this);
    return this;
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:6,代码来源:Proto.java


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