Enum Class JSONFunctions

java.lang.Object
java.lang.Enum<JSONFunctions>
com.blackrook.rookscript.functions.JSONFunctions
All Implemented Interfaces:
ScriptFunctionType, Serializable, Comparable<JSONFunctions>, java.lang.constant.Constable

public enum JSONFunctions extends Enum<JSONFunctions> implements ScriptFunctionType
Script common functions for converting JSON to Maps (and vice-versa).
Since:
1.6.0, 1.12.0, prettifying was added to WRITEJSON and JSONSTR.
Author:
Matthew Tropiano
  • Enum Constant Details

  • Method Details

    • values

      public static JSONFunctions[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static JSONFunctions valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • createResolver

      public static final ScriptFunctionResolver createResolver()
      Returns:
      a function resolver that handles all of the functions in this enum.
    • getParameterCount

      public int getParameterCount()
      Specified by:
      getParameterCount in interface ScriptFunctionType
      Returns:
      the total amount of parameters this takes.
    • getUsage

      public ScriptFunctionType.Usage getUsage()
      Specified by:
      getUsage in interface ScriptFunctionType
      Returns:
      this function's usage instructions.
    • execute

      public abstract boolean execute(ScriptInstance scriptInstance, ScriptValue returnValue)
      Description copied from interface: ScriptFunctionType
      Executes this function. The value in returnValue is automatically pushed onto the stack after the call. If a Throwable is thrown from this call, it is wrapped in a ScriptExecutionException. ScriptExecutionExceptions are thrown as-is.
      Specified by:
      execute in interface ScriptFunctionType
      Parameters:
      scriptInstance - the originating script instance.
      returnValue - the value pushed to the stack on return.
      Returns:
      if false, this halts script execution, else if true, continue.
    • usage

      protected abstract ScriptFunctionType.Usage usage()