本文整理汇总了Java中org.apache.el.ExpressionFactoryImpl类的典型用法代码示例。如果您正苦于以下问题:Java ExpressionFactoryImpl类的具体用法?Java ExpressionFactoryImpl怎么用?Java ExpressionFactoryImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExpressionFactoryImpl类属于org.apache.el包,在下文中一共展示了ExpressionFactoryImpl类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setupMocks
import org.apache.el.ExpressionFactoryImpl; //导入依赖的package包/类
@Before
public void setupMocks() throws Exception {
expressionFactory = new ExpressionFactoryImpl();
functionMapper = RuleEvaluator.FUNCTION_MAPPER;
testName = "testName";
testDefinition = new ConsumableTestDefinition();
testDefinition.setConstants(Collections.<String, Object>emptyMap());
testDefinition.setTestType(TestType.AUTHENTICATED_USER);
// most tests just set the salt to be the same as the test name
testDefinition.setSalt(testName);
testDefinition.setBuckets(INACTIVE_CONTROL_TEST_BUCKETS);
updateAllocations(RANGES_50_50);
final int effBuckets = INACTIVE_CONTROL_TEST_BUCKETS.size() - 1;
counts = new int[effBuckets];
hashes = new int[effBuckets];
}
开发者ID:indeedeng,项目名称:proctor,代码行数:19,代码来源:TestStandardTestChooser.java
示例2: initializeRandomTestChooser
import org.apache.el.ExpressionFactoryImpl; //导入依赖的package包/类
static RandomTestChooser initializeRandomTestChooser(final List<Range> ranges, final List<TestBucket> buckets) {
final ExpressionFactory expressionFactory = new ExpressionFactoryImpl();
final FunctionMapper functionMapper = RuleEvaluator.FUNCTION_MAPPER;
final ConsumableTestDefinition testDefinition = new ConsumableTestDefinition();
testDefinition.setConstants(Collections.<String, Object>emptyMap());
testDefinition.setBuckets(buckets);
final List<Allocation> allocations = Lists.newArrayList();
allocations.add(new Allocation("${}", ranges));
testDefinition.setAllocations(allocations);
final RandomTestChooser rtc = new RandomTestChooser(expressionFactory, functionMapper, "testName", testDefinition);
return rtc;
}
开发者ID:indeedeng,项目名称:proctor,代码行数:18,代码来源:TestRandomTestChooser.java
示例3: evalAttr
import org.apache.el.ExpressionFactoryImpl; //导入依赖的package包/类
private String evalAttr(String expression, char quote) {
ELContextImpl ctx = new ELContextImpl();
ctx.setFunctionMapper(new FMapper());
ExpressionFactoryImpl exprFactory = new ExpressionFactoryImpl();
ValueExpression ve = exprFactory.createValueExpression(ctx,
AttributeParser.getUnquoted(expression, quote, false, false,
false, false),
String.class);
return (String) ve.getValue(ctx);
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:12,代码来源:TestAttributeParser.java
示例4: evalAttr
import org.apache.el.ExpressionFactoryImpl; //导入依赖的package包/类
private String evalAttr(String expression, char quote) {
ELContextImpl ctx = new ELContextImpl();
ctx.setFunctionMapper(new FMapper());
ExpressionFactoryImpl exprFactory = new ExpressionFactoryImpl();
ValueExpression ve = exprFactory.createValueExpression(ctx,
AttributeParser.getUnquoted(expression, quote, false, false,
false),
String.class);
return (String) ve.getValue(ctx);
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:12,代码来源:TestAttributeParser.java
示例5: evaluateExpression
import org.apache.el.ExpressionFactoryImpl; //导入依赖的package包/类
public static Object evaluateExpression(EvaluationContext elContext,
String expression) {
ValueExpression result = new ExpressionFactoryImpl()
.createValueExpression(elContext, expression, Object.class);
return result.getValue(elContext);
}
开发者ID:EsfingeFramework,项目名称:querybuilder,代码行数:8,代码来源:ELUtils.java
示例6: evalAttr
import org.apache.el.ExpressionFactoryImpl; //导入依赖的package包/类
private String evalAttr(String expression, char quote) {
ELContextImpl ctx = new ELContextImpl();
ctx.setFunctionMapper(new FMapper());
ExpressionFactoryImpl exprFactory = new ExpressionFactoryImpl();
ValueExpression ve = exprFactory.createValueExpression(ctx,
AttributeParser.getUnquoted(expression, quote, false, false,
false),
String.class);
return (String) ve.getValue(ctx);
}
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:12,代码来源:TestAttributeParser.java
示例7: testExpressionFactory
import org.apache.el.ExpressionFactoryImpl; //导入依赖的package包/类
@Test
public void testExpressionFactory() {
assertThat(this.myfacesProperties.getExpressionFactory()).isEqualTo(ExpressionFactoryImpl.class);
}
开发者ID:joinfaces,项目名称:joinfaces,代码行数:5,代码来源:MyfacesPropertiesExpressionLanguageIT.java
示例8: main
import org.apache.el.ExpressionFactoryImpl; //导入依赖的package包/类
public static void main(final String[] args) {
final FunctionMapper functionMapper = new LibraryFunctionMapperBuilder().add("proctor", ProctorRuleFunctions.class).build();
final ExpressionFactory expressionFactory = new ExpressionFactoryImpl();
final CompositeELResolver elResolver = new CompositeELResolver();
elResolver.add(new ArrayELResolver());
elResolver.add(new ListELResolver());
elResolver.add(new BeanELResolver());
elResolver.add(new MapELResolver());
final Map<String, Object> values = Maps.newLinkedHashMap();
values.put("countries", Sets.newHashSet("AA", "BB", "CC", "DD", "EE", "FF", "GG", "HH", "II", "JJ", "KK", "LL", "MM"));
values.put("AA", "AA");
values.put("CC", "CC");
values.put("NN", "NN");
values.put("ZZ", "ZZ");
values.put("I1", 239235);
values.put("I2", 569071142);
values.put("I3", -189245);
values.put("D1", 129835.12512);
values.put("D2", -9582.9385);
values.put("D3", 98982223.598731412);
values.put("BT", Boolean.TRUE);
values.put("BF", Boolean.FALSE);
values.put("GLOOP", "");
final String[] expressions = {
"${proctor:contains(countries, AA) || proctor:contains(countries, CC) || D2 < I3 && BF}",
"${! proctor:contains(countries, ZZ) && I1 < I2 && empty GLOOP}",
"${I2 - I3 + D3 - D1}",
"${NN == '0' && ZZ == 'ZZ'}",
"${BT != BF}",
};
final int iterations = 100*1000;
long elapsed = -System.currentTimeMillis();
for (int i = 0; i < iterations; i++) {
final Map<String, ValueExpression> localContext = ProctorUtils.convertToValueExpressionMap(expressionFactory, values);
final VariableMapper variableMapper = new MulticontextReadOnlyVariableMapper(localContext);
final ELContext elContext = new ELContext() {
@Override
public ELResolver getELResolver() {
return elResolver;
}
@Override
public FunctionMapper getFunctionMapper() {
return functionMapper;
}
@Override
public VariableMapper getVariableMapper() {
return variableMapper;
}
};
for (int j = 0; j < expressions.length; j++) {
final ValueExpression ve = expressionFactory.createValueExpression(elContext, expressions[j], Object.class);
final Object result = ve.getValue(elContext);
if (i % 10000 == 0) {
System.out.println(result);
}
}
}
elapsed += System.currentTimeMillis();
final int total = iterations * expressions.length;
System.out.println(total + " expressions in " + elapsed + " ms (average " + (elapsed/(((double) total))) + " ms/expression)");
}
开发者ID:indeedeng,项目名称:proctor,代码行数:72,代码来源:BenchmarkEl.java
注:本文中的org.apache.el.ExpressionFactoryImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论