congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Expression.get
Code IndexAdd Tabnine to your IDE (free)

How to use
get
method
in
com.wizzardo.tools.evaluation.Expression

Best Java code snippets using com.wizzardo.tools.evaluation.Expression.get (Showing top 20 results out of 315)

origin: com.wizzardo.tools/tools-evaluation

  @Override
  public Object get(Map<String, Object> model) {
//        HashMap<String, Object> local = new HashMap<String, Object>(model);
    Object ob = null;
    for (Expression expression : expressions) {
      ob = expression.get(model);
    }
    return ob;
  }

origin: com.wizzardo.tools/tools-evaluation

  @Override
  public Object get(Map<String, Object> model) {
    if ((Boolean) condition.get(model)) {
      return thenStatement.get(model);
    } else if (elseStatement != null) {
      return elseStatement.get(model);
    }
    return null;
  }
}
origin: com.wizzardo.tools/tools-evaluation

  @Override
  public Object get(Map<String, Object> model) {
    Object o = inner.get(model);
    try {
      return clazz.cast(o);
    } catch (ClassCastException e) {
      throw new ClassCastException(o.getClass().getCanonicalName() + " cannot be cast to " + clazz.getCanonicalName());
    }
  }
}
origin: wizzardo/tools

  @Override
  public Object get(Map<String, Object> model) {
    Object o = inner.get(model);
    try {
      return clazz.cast(o);
    } catch (ClassCastException e) {
      throw new ClassCastException(o.getClass().getCanonicalName() + " cannot be cast to " + clazz.getCanonicalName());
    }
  }
}
origin: wizzardo/tools

  @SuppressWarnings("unchecked")
  public static <T> T evaluate(String exp, Map<String, Object> model) {
//        System.out.println("evaluate: " + exp + "\t" + model);
    Expression ex = prepare(exp, model);
    return (T) ex.get(model);
  }

origin: com.wizzardo.tools/tools-evaluation

  @SuppressWarnings("unchecked")
  public static <T> T evaluate(String exp) {
//        System.out.println("evaluate: " + exp + "\t" + model);
    Expression ex = prepare(exp, null);
    return (T) ex.get(null);
  }

origin: com.wizzardo.tools/tools-evaluation

  @SuppressWarnings("unchecked")
  public static <T> T evaluate(String exp, Map<String, Object> model) {
//        System.out.println("evaluate: " + exp + "\t" + model);
    Expression ex = prepare(exp, model);
    return (T) ex.get(model);
  }

origin: com.wizzardo.tools/tools-evaluation

  @SuppressWarnings("unchecked")
  public static <T> T evaluate(String exp, Map<String, Object> model, Map<String, UserFunction> functions) {
//        System.out.println("evaluate: " + exp + "\t" + model);
    Expression ex = prepare(exp, model, functions);
    return (T) ex.get(model);
  }

origin: com.wizzardo.tools/tools-evaluation

@Override
public Object get(Map<String, Object> model) {
  if (result != null)
    return result;
  Object r = condition.get(model);
  Boolean result = toBoolean(r);
  if (condition.hardcoded)
    this.result = result;
  return result;
}
origin: wizzardo/tools

@Override
public Object get(Map<String, Object> model) {
  if (result != null)
    return result;
  Object r = condition.get(model);
  Boolean result = toBoolean(r);
  if (condition.hardcoded)
    this.result = result;
  return result;
}
origin: wizzardo/tools

  @SuppressWarnings("unchecked")
  public static <T> T evaluate(String exp) {
//        System.out.println("evaluate: " + exp + "\t" + model);
    Expression ex = prepare(exp, null);
    return (T) ex.get(null);
  }

origin: wizzardo/tools

  @SuppressWarnings("unchecked")
  public static <T> T evaluate(String exp, Map<String, Object> model, Map<String, UserFunction> functions) {
//        System.out.println("evaluate: " + exp + "\t" + model);
    Expression ex = prepare(exp, model, functions);
    return (T) ex.get(model);
  }

origin: wizzardo/tools

@Test
public void testClone() throws Exception {
  String exp = "1+\"ololo\".substring(2)";
  Expression eh = EvalTools.prepare(exp);
  Object ob1 = eh.get(null);
  Object ob2 = eh.get(null);
  assertTrue(ob1 == ob2);
  eh = eh.clone();
  Object ob3 = eh.get(null);
  assertTrue(ob1 != ob3);
  assertTrue(ob1.equals(ob3));
}
origin: wizzardo/tools

@Test
public void test_imports_2() {
  String s = "import " + AtomicInteger.class.getCanonicalName() + ";\n" +
      "i = new AtomicInteger(1)";
  Expression expression = EvalTools.prepare(s);
  Map model = new HashMap();
  expression.get(model);
  Assert.assertEquals(1, model.size());
  Assert.assertEquals(1, ((AtomicInteger) model.get("i")).get());
}
origin: wizzardo/tools

@Test
public void testComment_1() {
  Map<String, Object> model = new HashMap<String, Object>();
  String s = "a = 1\n//a=2";
  Assert.assertEquals(1, EvalTools.prepare(s).get(model));
}
origin: wizzardo/tools

@Test
public void test_4() {
  String s = "a { b { c = 'value'} }";
  Expression expression = EvalTools.prepare(s);
  Config config = new Config();
  expression.get(config);
  Assert.assertEquals(1, config.size());
  Assert.assertEquals("value", ((Map) ((Map) config.get("a")).get("b")).get("c"));
}
origin: wizzardo/tools

@Test
public void test_closures() {
  String s = "a = 1\n" +
      "s = \"|${{->a}}|\"\n" +
      "c = {a}\n" +
      "a=2";
  Expression expression = EvalTools.prepare(s);
  Config config = new Config();
  expression.get(config);
  Assert.assertEquals(Integer.valueOf(2), config.get("a", 0));
  Assert.assertEquals("|2|", config.get("s").toString());
}
origin: wizzardo/tools

@Test
public void test_closure() {
  String s = "" +
      "closure = {'bar'}\n" +
      "foo = closure()" +
      "";
  Expression expression = EvalTools.prepare(s);
  Config config = new Config();
  expression.get(config);
  Assert.assertEquals("bar", config.get("foo"));
}
origin: wizzardo/tools

@Test
public void test_5() {
  String s = "a { b = 'value'; c = 'value 2' }";
  Expression expression = EvalTools.prepare(s);
  Config config = new Config();
  expression.get(config);
  Assert.assertEquals(1, config.size());
  Assert.assertEquals("value", ((Map) config.get("a")).get("b"));
  Assert.assertEquals("value 2", ((Map) config.get("a")).get("c"));
}
origin: wizzardo/tools

@Test
public void test_comment_4() {
  String s = "b = 'this // is not a comment'\n" +
      "c = '/*also just a string*/'";
  Expression expression = EvalTools.prepare(s);
  Config config = new Config();
  expression.get(config);
  Assert.assertEquals("this // is not a comment", config.get("b", ""));
  Assert.assertEquals("/*also just a string*/", config.get("c", ""));
}
com.wizzardo.tools.evaluationExpressionget

Popular methods of Expression

  • setVariable
  • clone
  • parse
  • raw
  • removeUnderscores
  • toString

Popular in Java

  • Reactive rest calls using spring rest template
  • requestLocationUpdates (LocationManager)
  • getExternalFilesDir (Context)
  • runOnUiThread (Activity)
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now