JEXL 3.5.0 Zugriff auf Bean -Eigenschaften nicht zugreifenJava

Java-Forum
Anonymous
 JEXL 3.5.0 Zugriff auf Bean -Eigenschaften nicht zugreifen

Post by Anonymous »

Ich habe einen kleinen POC gemacht, um die Verwendung von JEXL 3.5.0 wie folgt zu untersuchen: < /p>

Code: Select all

private static JexlEngine jexl = new JexlBuilder().create();

public static void main(String[] args) {
JexlContext context = getJexlContext();
rule9(context);
}

//
private static void rule9(JexlContext context) {
JexlExpression expr = jexl.createExpression("1000 >= loan.property");
Object result = expr.evaluate(context);
System.out.println("R9: " + result);
}
...

private static JexlContext getJexlContext() {
JexlContext context = new MapContext();
var loan = new LoanBean();
loan.setProperty(100.1);                 //this is a Double property of the bean
context.set("loan", loan);
return context;
}
und eine Leihbean ist eine sehr einfache Java -Klasse mit 1 Eigenschaft:
public class LoanBean {
private Double property;
public Double getProperty() {
return property;
}
public void setProperty(Double property) {
this.property = property;
}
}
< /code>
, aber ich erhalte einen Fehler wie folgt: < /p>

Ausnahme in Thread "Haupt"
org.apache.commons.jexl3.jexexexlexexexexexProperty: jexl.rule9: 29@1: 18
unddedede, Eigenschaft 'atdede. />jexl.main(jexl.java:21)
< /blockquote>
PS Wenn ich eine Karte anstelle einer Bean verwende, funktioniert es. < /P>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post