Class SJavaParser


  • public class SJavaParser
    extends java.lang.Object
    Static java parser helper.
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SJavaParser

        public SJavaParser()
    • 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.