Package jadex.javaparser
Class SJavaParser
java.lang.Object
jadex.javaparser.SJavaParser
Static java parser helper.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Object
evaluateExpression
(String exptxt, jadex.common.IValueFetcher fetcher) Evaluates a java expression.static Object
evaluateExpression
(String exptxt, String[] imports, jadex.common.IValueFetcher fetcher, ClassLoader classloader) Evaluates a java expression.static Object
evaluateExpressionPotentially
(String text, String[] imports, jadex.common.IValueFetcher fetcher, ClassLoader cl) Evaluate a string that is possiby an expression.static Object
getParsedValue
(Object value, String[] imports, jadex.common.IValueFetcher fetcher, ClassLoader classloader) Get a parsed value.static Object
getProperty
(Map<String, Object> properties, String name, String[] imports, jadex.common.IValueFetcher fetcher, ClassLoader classloader) Get a parsed property.static boolean
isExpressionString
(String text) Check if string is an expression.static IParsedExpression
parseExpression
(jadex.common.UnparsedExpression ue, String[] imports, ClassLoader classloader) Parse the expression.static IParsedExpression
parseExpression
(String exptxt, String[] imports, ClassLoader classloader) Evaluates a java expression.
-
Field Details
-
parser
The java parser.
-
-
Constructor Details
-
SJavaParser
public SJavaParser()
-
-
Method Details
-
evaluateExpression
Evaluates a java expression.- Parameters:
fetcher
- Expression parameters can be supplied as value fetcher.- Returns:
- The evaluated object.
-
evaluateExpression
public static Object evaluateExpression(String exptxt, String[] imports, jadex.common.IValueFetcher fetcher, ClassLoader classloader) Evaluates a java expression.- Parameters:
fetcher
- Expression parameters can be supplied as value fetcher.- Returns:
- The evaluated object.
-
parseExpression
public static IParsedExpression parseExpression(String exptxt, String[] imports, ClassLoader classloader) Evaluates a java expression.- Returns:
- The evaluated object.
-
parseExpression
public static IParsedExpression parseExpression(jadex.common.UnparsedExpression ue, String[] imports, ClassLoader classloader) Parse the expression. The result is cached for later accesses. -
getProperty
public static Object getProperty(Map<String, Object> properties, String name, String[] imports, jadex.common.IValueFetcher fetcher, ClassLoader classloader) Get a parsed property. Handles properties, which may be parsed or unparsed, and always returns a parsed property value.- Parameters:
name
- The property name.- Returns:
- The property value or null if property not defined.
-
getParsedValue
public static Object getParsedValue(Object value, String[] imports, jadex.common.IValueFetcher fetcher, ClassLoader classloader) Get a parsed value. Handles values, which may be parsed or unparsed, and always returns a parsed value.- Parameters:
value
- The value.- Returns:
- The parsed and evaluated value.
-
evaluateExpressionPotentially
public static Object evaluateExpressionPotentially(String text, String[] imports, jadex.common.IValueFetcher fetcher, ClassLoader cl) Evaluate a string that is possiby an expression. Expressions must use %{}- Parameters:
text
- The expression text.imports
- The imports.fetcher
- The fetcher.cl
- The classloader.- Returns:
- The evaluated expression or the text.
-
isExpressionString
Check if string is an expression.- Parameters:
text
- The expression text.- Returns:
- True, if is expression.
-