Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1027710 // JEXL Test (OK)

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 414K of libraries. Click here for Pure Java version (7219L/51K).

1  
!7
2  
3  
lib 1400354 // JEXL
4  
lib 1400355 // commons logging api
5  
6  
import org.apache.commons.jexl3.*;
7  
8  
p-exp {
9  
  JexlEngine jexl = new JexlBuilder().create();
10  
  
11  
  S exp = "a*2+b";
12  
  JexlExpression expr = jexl.createExpression(exp);
13  
14  
  // populate the context
15  
  JexlContext context = new MapContext;
16  
  context.set("a", 5);
17  
  context.set("b", 1);
18  
19  
  // evaluate
20  
  assertEqualsVerbose(11, expr.evaluate(context));
21  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027710
Snippet name: JEXL Test (OK)
Eternal ID of this version: #1027710/10
Text MD5: b2a72c590152d6616d7574370f8db216
Transpilation MD5: bc36006c6c84c8be0503665f644c2a28
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-04 17:10:39
Source code size: 426 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 279 / 1004
Version history: 9 change(s)
Referenced in: [show references]