Class Scripts


  • public class Scripts
    extends Object
    Provides implementations of a variety of SPIs using scripting.
    Author:
    jhyde
    • Constructor Detail

      • Scripts

        public Scripts()
    • Method Detail

      • propertyFormatter

        public static PropertyFormatter propertyFormatter​(String scriptText,
                                                          String scriptLanguage)
        Creates an implementation of the PropertyFormatter SPI based on a script.
        Parameters:
        scriptText - Script text
        scriptLanguage - Script language
        Returns:
        property formatter
      • memberFormatter

        public static MemberFormatter memberFormatter​(String scriptText,
                                                      String scriptLanguage)
        Creates an implementation of the MemberFormatter SPI based on a script.
        Parameters:
        scriptText - Script text
        scriptLanguage - Script language
        Returns:
        member formatter
      • cellFormatter

        public static CellFormatter cellFormatter​(String scriptText,
                                                  String scriptLanguage)
        Creates an implementation of the CellFormatter SPI based on a script.
        Parameters:
        scriptText - Script text
        scriptLanguage - Script language
        Returns:
        cell formatter
      • userDefinedFunction

        public static UserDefinedFunction userDefinedFunction​(Scripts.ScriptDefinition script,
                                                              String name)
        Creates an implementation of the UserDefinedFunction SPI based on a script.

        The script must declare an object called "obj" that must have a method "evaluate(evaluator, arguments)" and may have fields "name", "description", "syntax", "parameterTypes" and method "getReturnType(parameterTypes)".

        Parameters:
        script - Script
        Returns:
        user-defined function