Questions tagged [mvel]

MVEL is a powerful expression language for Java-based applications.

MVEL is a powerful expression language for Java-based applications.

201 questions
1
vote
1 answer

MVEL vs reflection. What is generally faster regarding object member access?

What is generally faster regarding object member access? 1. Execute compiled mvel expression 2. Execute cached reflection method
Mike
  • 20,010
  • 25
  • 97
  • 140
1
vote
1 answer

MVEL null value in equality operator

If I have this script in MVEL: myString = null; if (myString == "Foo") { return true; } Would I get a null pointer in this script? Because I read the documentation but it says the == operator is similar to the .equals() method in java which…
Ogen
  • 6,499
  • 7
  • 58
  • 124
1
vote
0 answers

MVEL script execution error "no context" after library update

I have a problem with MVEL running very simple 2-lines script like this: for (int i=0; i < 1; i++) {} for (int j=0; j < 1; j++) {} With MVEL library of version 2.2.3 and higher there is always such error: Exception in thread "main"…
agolubev81
  • 41
  • 4
1
vote
1 answer

How to access a variable declared inside a MVEL expression?

Suppose I write a code like this: public class SomeClass() { public static void main(String[] args) { MVEL.eval("boolean boolVar = 2<3;"); } } Now is it possible to access this boolVar variable in the Java code anywhere. Example: Can I…
Anuj
  • 97
  • 1
  • 9
1
vote
1 answer

Validate MVEL expression in java

User will enter some formula/expression. I want to check whether the formula/expression which is a String input to my function is correct(as per MVEL standard) or not. Following is a valid expression, String validFormula = "if(dueDate >…
Prashant Shilimkar
  • 8,402
  • 13
  • 54
  • 89
1
vote
1 answer

Add elements to a list of map using MEL/MVEL

How can i add elements to a list of map using Mule MEL ? I have gone through the mule MEL documentation and MVEL documentation but could not find any examples for them
Sudarshan
  • 8,574
  • 11
  • 52
  • 74
1
vote
0 answers

How to check if geopoint type set to null in elasticsearch using mvel?

How do i check if a geopoint value is set to null (for custom scoring using mvel)? Should the value be '' or null? And if so how do i check if the value is '' or null? So my document structure is like this document 1 { "id" : 100 …
Vinu K S
  • 783
  • 1
  • 8
  • 18
1
vote
1 answer

Mvel dynamic expression

Do you know if it's possible to dynamically evaluate an expression with Mvel. For example : VariableResolverFactory functionFactory = new MapVariableResolverFactory(); MVEL.eval("def SUM(op1,op2,op3) { result=0B; if(op1) result+=op2; else…
Gaetan56
  • 519
  • 2
  • 6
  • 17
1
vote
2 answers

MVEL expression with Numeric keys

We are using MVEL to evaluate the expression by passing the map in the context object. The map contains SNMP trap information such as OID and its values. e.g. sample Map contains following Keys and values. Map trapMap = new…
1
vote
1 answer

MVEL extracting a string from a string

I have the strings "000134567 - AA - 2001" and "002134567 - AB - 2001" and I want to extract all the numbers before the " - AA". But I only want to return the numbers starting from the first non-zero number. For example, I would want "134567" or…
XSL Noob
  • 51
  • 1
  • 6
1
vote
1 answer

In Drools, can a selection clause (using keyword `from`) be written over an Iterable or Iterator?

Given a Java interface like this: class Hobby { public String getName() {...} } class Person { public Iterable getHobbies() {...} } How can I, in a LHS expression, select Hobby objects with a specific name. For example, something…
E-Riz
  • 31,431
  • 9
  • 97
  • 134
1
vote
2 answers

drools.getRule().getName() in attributes -rule drool file

I need to enable / disable certain rules from drl file based on data from the backend . i.e enable Rule 1,2,3 for Dubai , Enable 1,3 for Singapore So , I pass drools.getRule().getName() as below. rule "Apply 50% discount to VIP customers" …
Hardik Amlani
  • 11
  • 1
  • 2
1
vote
1 answer

creating context for MVEL with different variable types

I am using MVEL to evaluate arithmetic and logical expressions or a combination of the two. The thing is that I do not know beforehand all the variable types, without creating a pretty complex parsing method for the expression itself (which is…
Marius
  • 990
  • 1
  • 14
  • 34
1
vote
1 answer

MEL null safe Xpath works in Studio but not Cloudhub

The following expression works fine locally in Studio, but when deployed to Cloudhub it fails with the below error: Its basically just a simple path expression that uses the null safe ? operator before invoke the .text method. Why doesn't this work…
jon lee
  • 887
  • 1
  • 15
  • 32
1
vote
1 answer

Unexpected MVEL2 behavior

I need to check if an expression is well written, so I decide to use MVEL2 to do this. I have an expression like String expression = "(OPVAL == 'OPERATION') && (DAT > '12345')" and an hash map like Map vars = new HashMap