Package jadex.javaparser
Class SJavaParser
- java.lang.Object
-
- jadex.javaparser.SJavaParser
-
public class SJavaParser extends java.lang.Object
Static java parser helper.
-
-
Field Summary
Fields Modifier and Type Field Description protected static IExpressionParser
parser
The java parser.
-
Constructor Summary
Constructors Constructor Description SJavaParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Object
evaluateExpression(java.lang.String exptxt, IValueFetcher fetcher)
Evaluates a java expression.static java.lang.Object
evaluateExpression(java.lang.String exptxt, java.lang.String[] imports, IValueFetcher fetcher, java.lang.ClassLoader classloader)
Evaluates a java expression.static java.lang.Object
evaluateExpressionPotentially(java.lang.String text, java.lang.String[] imports, IValueFetcher fetcher, java.lang.ClassLoader cl)
Evaluate a string that is possiby an expression.static java.lang.Object
getParsedValue(java.lang.Object value, java.lang.String[] imports, IValueFetcher fetcher, java.lang.ClassLoader classloader)
Get a parsed value.static java.lang.Object
getProperty(java.util.Map<java.lang.String,java.lang.Object> properties, java.lang.String name, java.lang.String[] imports, IValueFetcher fetcher, java.lang.ClassLoader classloader)
Get a parsed property.static boolean
isExpressionString(java.lang.String text)
Check if string is an expression.static IParsedExpression
parseExpression(UnparsedExpression ue, java.lang.String[] imports, java.lang.ClassLoader classloader)
Parse the expression.static IParsedExpression
parseExpression(java.lang.String exptxt, java.lang.String[] imports, java.lang.ClassLoader classloader)
Evaluates a java expression.
-
-
-
Field Detail
-
parser
protected static final IExpressionParser parser
The java parser.
-
-
Method Detail
-
evaluateExpression
public static java.lang.Object evaluateExpression(java.lang.String exptxt, IValueFetcher fetcher)
Evaluates a java expression.- Parameters:
fetcher
- Expression parameters can be supplied as value fetcher.- Returns:
- The evaluated object.
-
evaluateExpression
public static java.lang.Object evaluateExpression(java.lang.String exptxt, java.lang.String[] imports, IValueFetcher fetcher, java.lang.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(java.lang.String exptxt, java.lang.String[] imports, java.lang.ClassLoader classloader)
Evaluates a java expression.- Returns:
- The evaluated object.
-
parseExpression
public static IParsedExpression parseExpression(UnparsedExpression ue, java.lang.String[] imports, java.lang.ClassLoader classloader)
Parse the expression. The result is cached for later accesses.
-
getProperty
public static java.lang.Object getProperty(java.util.Map<java.lang.String,java.lang.Object> properties, java.lang.String name, java.lang.String[] imports, IValueFetcher fetcher, java.lang.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 java.lang.Object getParsedValue(java.lang.Object value, java.lang.String[] imports, IValueFetcher fetcher, java.lang.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 java.lang.Object evaluateExpressionPotentially(java.lang.String text, java.lang.String[] imports, IValueFetcher fetcher, java.lang.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
public static boolean isExpressionString(java.lang.String text)
Check if string is an expression.- Parameters:
text
- The expression text.- Returns:
- True, if is expression.
-
-