use of org.mule.mvel2.ParserConfiguration in project mule by mulesoft.
the class DateTimeExpressionLanguageFunctionTestCase method setup.
@Before
public void setup() throws InitialisationException {
ParserConfiguration parserConfiguration = new ParserConfiguration();
expressionExecutor = new MVELExpressionExecutor(parserConfiguration);
context = new MVELExpressionLanguageContext(parserConfiguration, Mockito.mock(MuleContext.class));
dateTimeFunction = new DateTimeExpressionLanguageFuntion();
context.declareFunction("dateTime", dateTimeFunction);
}
use of org.mule.mvel2.ParserConfiguration in project mule by mulesoft.
the class RegexExpressionLanguageFunctionTestCase method setup.
@Before
public void setup() throws InitialisationException {
ParserConfiguration parserConfiguration = new ParserConfiguration();
expressionExecutor = new MVELExpressionExecutor(parserConfiguration);
muleContext = mock(MuleContext.class);
context = new MVELExpressionLanguageContext(parserConfiguration, muleContext);
regexFuntion = new RegexExpressionLanguageFuntion();
context.declareFunction("regex", regexFuntion);
}
use of org.mule.mvel2.ParserConfiguration in project mule by mulesoft.
the class WildcardExpressionLanguageFunctionTestCase method setup.
@Before
public void setup() throws InitialisationException {
ParserConfiguration parserConfiguration = new ParserConfiguration();
expressionExecutor = new MVELExpressionExecutor(parserConfiguration);
muleContext = mock(MuleContext.class);
context = new MVELExpressionLanguageContext(parserConfiguration, muleContext);
wildcardFunction = new WildcardExpressionLanguageFuntion();
context.declareFunction("wildcard", wildcardFunction);
}
use of org.mule.mvel2.ParserConfiguration in project stargate-core by tuplejump.
the class AggregateFunction method getParserConfiguration.
private ParserConfiguration getParserConfiguration() {
ParserConfiguration parserConfig = new ParserConfiguration();
parserConfig.addPackageImport("java.util");
parserConfig.addPackageImport("org.apache.commons.lang3");
parserConfig.addPackageImport("org.joda.time");
parserConfig.addImport(Math.class);
if (imports != null) {
for (String imported : imports) parserConfig.addPackageImport(imported);
}
return parserConfig;
}
use of org.mule.mvel2.ParserConfiguration in project mvel by mikebrock.
the class ASTNode method optimize.
private Object optimize(Object ctx, Object thisValue, VariableResolverFactory factory) {
if ((fields & DEOP) != 0) {
fields ^= DEOP;
}
AccessorOptimizer optimizer;
Object retVal = null;
if ((fields & NOJIT) != 0 || factory != null && factory.isResolveable(nameCache)) {
optimizer = getAccessorCompiler(SAFE_REFLECTIVE);
} else {
optimizer = getDefaultAccessorCompiler();
}
ParserContext pCtx;
if ((fields & PCTX_STORED) != 0) {
pCtx = (ParserContext) literal;
} else {
pCtx = new ParserContext(new ParserConfiguration(getInjectedImports(factory), null));
}
try {
pCtx.optimizationNotify();
setAccessor(optimizer.optimizeAccessor(pCtx, expr, start, offset, ctx, thisValue, factory, true, egressType));
} catch (OptimizationNotSupported ne) {
setAccessor((optimizer = getAccessorCompiler(SAFE_REFLECTIVE)).optimizeAccessor(pCtx, expr, start, offset, ctx, thisValue, factory, true, null));
}
if (accessor == null) {
return get(expr, start, offset, ctx, factory, thisValue);
}
if (retVal == null) {
retVal = optimizer.getResultOptPass();
}
if (egressType == null) {
egressType = optimizer.getEgressType();
}
return retVal;
}
Aggregations