本文整理汇总了Java中org.mvel2.integration.VariableResolverFactory类的典型用法代码示例。如果您正苦于以下问题:Java VariableResolverFactory类的具体用法?Java VariableResolverFactory怎么用?Java VariableResolverFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VariableResolverFactory类属于org.mvel2.integration包,在下文中一共展示了VariableResolverFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
public static void main(String[] args) {
Foo foo = new Foo();
foo.setName("test");
Map context = new HashMap();
String expression = "foo.name == 'test'";
VariableResolverFactory functionFactory = new MapVariableResolverFactory(context);
context.put("foo",foo);
Boolean result = (Boolean) MVEL.eval(expression,functionFactory);
System.out.println(result);
Serializable compileExpression = MVEL.compileExpression(expression);
result = (Boolean) MVEL.executeExpression(compileExpression, context, functionFactory);
System.out.print(result);
}
开发者ID:brucefengnju,项目名称:eldemo,代码行数:17,代码来源:RunMvel.java
示例2: runMvel
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
public static void runMvel(int xmax, int ymax, int zmax) {
Map context = new HashMap();
String expression = "x + y*2 - z";
Serializable compileExpression = MVEL.compileExpression(expression);
Integer result = 0;
Date start = new Date();
for (int xval = 0; xval < xmax; xval++) {
for (int yval = 0; yval < ymax; yval++) {
for (int zval = 0; zval <= zmax; zval++) {
context.put("x", xval);
context.put("y", yval);
context.put("z", zval);
VariableResolverFactory functionFactory = new MapVariableResolverFactory(context);
Integer cal = (Integer) MVEL.executeExpression(compileExpression, context, functionFactory);
result += cal;
}
}
}
Date end = new Date();
System.out.println("MVEL:time is : " + (end.getTime() - start.getTime()) + ",result is " + result);
}
开发者ID:brucefengnju,项目名称:eldemo,代码行数:23,代码来源:RunPerform.java
示例3: optimizeAccessor
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
public Accessor optimizeAccessor(ParserContext pCtx, char[] property, Object ctx, Object thisRef,
VariableResolverFactory factory, boolean root, Class ingressType) {
this.rootNode = this.currNode = null;
this.start = this.cursor = 0;
this.first = true;
this.length = (this.expr = property).length;
this.ctx = ctx;
this.thisRef = thisRef;
this.variableFactory = factory;
this.ingressType = ingressType;
this.pCtx = pCtx;
return compileGetChain();
}
开发者ID:codehaus,项目名称:mvel,代码行数:17,代码来源:ReflectiveAccessorOptimizer.java
示例4: findClassImportResolverFactory
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
public static ClassImportResolverFactory findClassImportResolverFactory(VariableResolverFactory factory) {
VariableResolverFactory v = factory;
while (v != null) {
if (v instanceof ClassImportResolverFactory) {
return (ClassImportResolverFactory) v;
}
v = v.getNextFactory();
}
if (factory == null) {
throw new OptimizationFailure("unable to import classes. no variable resolver factory available.");
}
else {
return insertFactory(factory, new ClassImportResolverFactory());
}
}
开发者ID:codehaus,项目名称:mvel,代码行数:17,代码来源:ParseTools.java
示例5: optimize
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
private Object optimize(Object ctx, Object elCtx, VariableResolverFactory variableResolverFactory) {
if (DynamicOptimizer.isOverloaded()) {
DynamicOptimizer.enforceTenureLimit();
}
AccessorOptimizer ao = OptimizerFactory.getAccessorCompiler("ASM");
switch (type) {
case DynamicOptimizer.REGULAR_ACCESSOR:
_accessor = ao.optimizeAccessor(context, property, ctx, elCtx, variableResolverFactory, false, null);
return ao.getResultOptPass();
case DynamicOptimizer.OBJ_CREATION:
_accessor = ao.optimizeObjectCreation(context, property, ctx, elCtx, variableResolverFactory);
return _accessor.getValue(ctx, elCtx, variableResolverFactory);
case DynamicOptimizer.COLLECTION:
_accessor = ao.optimizeCollection(AbstractParser.getCurrentThreadParserContext(), ctx, null, property, ctx, elCtx, variableResolverFactory);
return _accessor.getValue(ctx, elCtx, variableResolverFactory);
}
return null;
}
开发者ID:codehaus,项目名称:mvel,代码行数:21,代码来源:DynamicGetAccessor.java
示例6: setValue
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
public Object setValue(Object ctx, Object elCtx, VariableResolverFactory variableFactory, Object value) {
if (!opt) {
if (++runcount > DynamicOptimizer.tenuringThreshold) {
if ((currentTimeMillis() - stamp) < DynamicOptimizer.timeSpan) {
opt = true;
return optimize(ctx, elCtx, variableFactory, value);
}
else {
runcount = 0;
stamp = currentTimeMillis();
}
}
}
_accessor.setValue(ctx, elCtx, variableFactory, value);
return value;
}
开发者ID:codehaus,项目名称:mvel,代码行数:18,代码来源:DynamicSetAccessor.java
示例7: getValue
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
public Object getValue(Object ctx, Object elCtx, VariableResolverFactory variableFactory) {
if (!opt) {
if (++runcount > DynamicOptimizer.tenuringThreshold) {
if ((currentTimeMillis() - stamp) < DynamicOptimizer.timeSpan) {
opt = true;
return optimize(AbstractParser.getCurrentThreadParserContext(), ctx, elCtx, variableFactory);
}
else {
runcount = 0;
stamp = currentTimeMillis();
}
}
}
return _accessor.getValue(ctx, elCtx, variableFactory);
}
开发者ID:codehaus,项目名称:mvel,代码行数:18,代码来源:DynamicCollectionAccessor.java
示例8: execute
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
public Integer execute(String columnValue, Map<String, Object> extension) {
Map<String, Object> vrs = new HashMap<String, Object>();
//, Map<String, ElFunction<?,?>> functionMap
//vrs.putAll(functionMap);// 拓展函数
Map<String, Object> params = new HashMap<String, Object>();
params.put("value", columnValue);
vrs.put("$ROOT", params);
VariableResolverFactory vrfactory = new MapVariableResolverFactory(vrs);
return MVEL.eval(expression, params, vrfactory, Integer.class);
}
开发者ID:tongbanjie,项目名称:baymax,代码行数:11,代码来源:ELFunction.java
示例9: setValue
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
public Object setValue(Object ctx, Object elCtx, VariableResolverFactory variableFactory, Object value) {
if (nextNode != null) {
return nextNode.setValue(propertyHandler.getProperty(propertyName, ctx, variableFactory), ctx, variableFactory, value);
}
else {
return propertyHandler.setProperty(propertyName, ctx, variableFactory, value);
}
}
开发者ID:codehaus,项目名称:mvel,代码行数:9,代码来源:PropertyHandlerAccessor.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: executeExpression
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
public static <T> T executeExpression(final Object compiledExpression, final Object ctx, final VariableResolverFactory vars, Class<T> toType) {
try {
return convert(executeExpression(compiledExpression, ctx, vars), toType);
}
catch (EndWithValue end) {
return convert(end.getValue(), toType);
}
}
开发者ID:codehaus,项目名称:mvel,代码行数:9,代码来源:MVEL.java
示例12: checkBreak
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
public int checkBreak(LineLabel label, VariableResolverFactory factory, CompiledExpression expression) {
if (debuggerState == Debugger.STEP || hasBreakpoint(label)) {
if (debugger == null) throw new RuntimeException("no debugger registered to handle breakpoint");
return debuggerState = debugger.onBreak(new Frame(label, factory, expression.getParserContext()));
}
return 0;
}
开发者ID:codehaus,项目名称:mvel,代码行数:9,代码来源:DebuggerContext.java
示例13: getInjectedImports
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
public static Map<String, Object> getInjectedImports(VariableResolverFactory factory) {
if (factory == null) return null;
do {
if (factory instanceof ClassImportResolverFactory) {
return ((ClassImportResolverFactory) factory).getImportedClasses();
}
}
while ((factory = factory.getNextFactory()) != null);
return null;
}
开发者ID:codehaus,项目名称:mvel,代码行数:12,代码来源:CompilerTools.java
示例14: setValue
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
public Object setValue(Object ctx, Object elCtx, VariableResolverFactory vrf, Object value) {
if (accessor == null) {
if (ingressType == Object.class && value != null) ingressType = value.getClass();
accessor = getThreadAccessorOptimizer()
.optimizeSetAccessor(context, expression, ctx, ctx, vrf, false, value, ingressType);
}
else {
accessor.setValue(ctx, elCtx, vrf, value);
}
return value;
}
开发者ID:codehaus,项目名称:mvel,代码行数:13,代码来源:CompiledAccExpression.java
示例15: insertFactory
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
public void insertFactory(VariableResolverFactory resolverFactory) {
if (nextFactory == null) {
nextFactory = resolverFactory;
}
else {
resolverFactory.setNextFactory(nextFactory = resolverFactory);
}
}
开发者ID:codehaus,项目名称:mvel,代码行数:9,代码来源:BaseVariableResolverFactory.java
示例16: executeAll
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
private Object[] executeAll(Object ctx, VariableResolverFactory vars) {
if (length == 0) return GetterAccessor.EMPTY;
Object[] vals = new Object[length];
for (int i = 0; i < length; i++) {
vals[i] = parms[i].getValue(ctx, vars);
}
return vals;
}
开发者ID:codehaus,项目名称:mvel,代码行数:10,代码来源:ConstructorAccessor.java
示例17: ClassImportResolverFactory
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
public ClassImportResolverFactory(ParserConfiguration ctx, VariableResolverFactory nextFactory) {
packageImports = ctx.getPackageImports();
Map<String, Object> classes = ctx.getImports();
classLoader = ctx.getClassLoader();
this.nextFactory = nextFactory;
this.variableResolvers = new HashMap<String, VariableResolver>();
for (Map.Entry<String, Object> e : classes.entrySet()) {
variableResolvers.put(e.getKey(), new SimpleValueResolver(e.getValue()));
}
}
开发者ID:codehaus,项目名称:mvel,代码行数:13,代码来源:ClassImportResolverFactory.java
示例18: optimizeAccessor
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
public Accessor optimizeAccessor(ParserContext pCtx, char[] property, Object ctx, Object thisRef,
VariableResolverFactory factory, boolean rootThisRef, Class ingressType) {
synchronized (oLock) {
return classLoader.registerDynamicAccessor(new DynamicGetAccessor(pCtx, property, 0,
firstStage.optimizeAccessor(pCtx, property, ctx, thisRef, factory, rootThisRef, ingressType)));
}
}
开发者ID:codehaus,项目名称:mvel,代码行数:8,代码来源:DynamicOptimizer.java
示例19: getReducedValue
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) {
try {
return compile(valueOf(eval(pattern, ctx, factory))).matcher(valueOf(eval(name, ctx, factory))).matches();
}
catch (PatternSyntaxException e) {
throw new CompileException("bad regular expression", e);
}
}
开发者ID:codehaus,项目名称:mvel,代码行数:9,代码来源:RegExMatch.java
示例20: getReducedValueAccelerated
import org.mvel2.integration.VariableResolverFactory; //导入依赖的package包/类
public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
if (accessor != null) {
return accessor.getValue(literal, thisValue, factory);
}
else {
AccessorOptimizer aO = getThreadAccessorOptimizer();
accessor = aO.optimizeAccessor(getCurrentThreadParserContext(), name, literal, thisValue, factory, false, null);
return aO.getResultOptPass();
}
}
开发者ID:codehaus,项目名称:mvel,代码行数:11,代码来源:LiteralDeepPropertyNode.java
注:本文中的org.mvel2.integration.VariableResolverFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论