de.odysseus.el.ExpressionFactoryImpl Java Examples

The following examples show how to use de.odysseus.el.ExpressionFactoryImpl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JuelUtils.java    From rheem with Apache License 2.0 6 votes vote down vote up
public JuelFunction(String juelExpression, Class<T> resultClass, Map<String, Class<?>> arguments) {
            // Initialize the JUEL conext.
            this.expressionFactory = new de.odysseus.el.ExpressionFactoryImpl();
            this.initializeContext(this.context = new SimpleContext());

            // Index the arguments.
            Class<?>[] argumentTypeClasses = new Class[arguments.size()];
            int argIndex = 0;
            for (Map.Entry<String, Class<?>> argumentEntry : arguments.entrySet()) {
                final String argName = argumentEntry.getKey();
                final Class<?> argTypeClass = argumentEntry.getValue();
                final TreeValueExpression argExpression =
                        this.expressionFactory.createValueExpression(this.context, String.format("${%s}", argName), argTypeClass);
                Argument argument = new Argument(argIndex++, argTypeClass, argExpression);
                argumentTypeClasses[argument.index] = argument.typeClass;
                this.arguments.put(argName, argument);
            }

            // Create the JUEL method.
            this.expression = expressionFactory.createValueExpression(this.context, juelExpression, resultClass);
//            this.expression = expressionFactory.createMethodExpression(this.context, juelExpression, resultClass, argumentTypeClasses);
        }
 
Example #2
Source File: Jinjava.java    From jinjava with Apache License 2.0 6 votes vote down vote up
/**
 * Create a new jinjava processor instance with the specified global config
 *
 * @param globalConfig
 *          used for all render operations performed by this processor instance
 */
public Jinjava(JinjavaConfig globalConfig) {
  this.globalConfig = globalConfig;
  this.globalContext = new Context();

  Properties expConfig = new Properties();
  expConfig.setProperty(
    TreeBuilder.class.getName(),
    ExtendedSyntaxBuilder.class.getName()
  );

  TypeConverter converter = new TruthyTypeConverter();
  this.expressionFactory = new ExpressionFactoryImpl(expConfig, converter);

  this.resourceLocator = new ClasspathResourceLocator();
}
 
Example #3
Source File: FeelEngineFactoryImpl.java    From camunda-engine-dmn with Apache License 2.0 5 votes vote down vote up
protected ExpressionFactory createExpressionFactory() {
  Properties properties = new Properties();
  properties.put(ExpressionFactoryImpl.PROP_CACHE_SIZE, String.valueOf(expressionCacheSize));

  try {
    return new ExpressionFactoryImpl(properties, createTypeConverter());
  }
  catch (ELException e) {
    throw LOG.unableToInitializeFeelEngine(e);
  }
}
 
Example #4
Source File: FeelEngineFactoryImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected ExpressionFactory createExpressionFactory() {
  Properties properties = new Properties();
  properties.put(ExpressionFactoryImpl.PROP_CACHE_SIZE, String.valueOf(expressionCacheSize));

  try {
    return new ExpressionFactoryImpl(properties, createTypeConverter());
  }
  catch (ELException e) {
    throw LOG.unableToInitializeFeelEngine(e);
  }
}
 
Example #5
Source File: ExpressionManager.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public ExpressionManager(Map<Object, Object> beans, boolean initFactory) {
  // Use the ExpressionFactoryImpl in activiti build in version of juel,
  // with parametrised method expressions enabled
  expressionFactory = new ExpressionFactoryImpl();
  this.beans = beans;
}
 
Example #6
Source File: ExpressionFactoryResolver.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public static ExpressionFactory resolveExpressionFactory() {
  // Return instance of custom JUEL implementation
  return new ExpressionFactoryImpl();
}
 
Example #7
Source File: ExpressionManager.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public ExpressionManager(Map<Object, Object> beans, boolean initFactory) {
  // Use the ExpressionFactoryImpl in activiti build in version of juel,
  // with parametrised method expressions enabled
  expressionFactory = new ExpressionFactoryImpl();
  this.beans = beans;
}
 
Example #8
Source File: ExpressionFactoryResolver.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public static ExpressionFactory resolveExpressionFactory() {
  // Return instance of custom JUEL implementation
  return new ExpressionFactoryImpl();
}
 
Example #9
Source File: JuelConnector.java    From scipio-erp with Apache License 2.0 4 votes vote down vote up
/** Returns an <code>ExpressionFactory</code> instance.
 * @return A customized <code>ExpressionFactory</code> instance
 */
public static ExpressionFactory newExpressionFactory() {
    return new ExpressionFactoryImpl(new TreeStore(new ExtendedBuilder(), new Cache(1000)));
}
 
Example #10
Source File: JuelElProvider.java    From camunda-engine-dmn with Apache License 2.0 4 votes vote down vote up
public JuelElProvider() {
  this(new ExpressionFactoryImpl(), new JuelElContextFactory(createDefaultResolver()));
}
 
Example #11
Source File: JuelElProvider.java    From camunda-engine-dmn with Apache License 2.0 4 votes vote down vote up
public JuelElProvider(ExpressionFactoryImpl expressionFactory, JuelElContextFactory elContextFactory) {
  this.factory = expressionFactory;
  this.elContextFactory = elContextFactory;
  this.parsingElContext = createDefaultParsingElContext();
}
 
Example #12
Source File: JuelElProvider.java    From camunda-engine-dmn with Apache License 2.0 4 votes vote down vote up
public ExpressionFactoryImpl getFactory() {
  return factory;
}
 
Example #13
Source File: JuelElProvider.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public JuelElProvider() {
  this(new ExpressionFactoryImpl(), new JuelElContextFactory(createDefaultResolver()));
}
 
Example #14
Source File: JuelElProvider.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public JuelElProvider(ExpressionFactoryImpl expressionFactory, JuelElContextFactory elContextFactory) {
  this.factory = expressionFactory;
  this.elContextFactory = elContextFactory;
  this.parsingElContext = createDefaultParsingElContext();
}
 
Example #15
Source File: JuelElProvider.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public ExpressionFactoryImpl getFactory() {
  return factory;
}