本文整理汇总了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;
}
}
示例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));
}
示例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));
}
示例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;
}
示例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);
}
}
}
}
}
示例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());
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例15: getReducedValue
import org.mvel2.integration.VariableResolverFactory; //导入方法依赖的package包/类
@Override
public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) {
factory.createVariable(name, this);
return this;
}