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).

!7

lib 1400354 // JEXL
lib 1400355 // commons logging api

import org.apache.commons.jexl3.*;

p-exp {
  JexlEngine jexl = new JexlBuilder().create();
  
  S exp = "a*2+b";
  JexlExpression expr = jexl.createExpression(exp);

  // populate the context
  JexlContext context = new MapContext;
  context.set("a", 5);
  context.set("b", 1);

  // evaluate
  assertEqualsVerbose(11, expr.evaluate(context));
}

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: 159 / 705
Version history: 9 change(s)
Referenced in: [show references]