Enum Class Options

java.lang.Object
java.lang.Enum<Options>
com.googlecode.aviator.Options
All Implemented Interfaces:
Serializable, Comparable<Options>, Constable

public enum Options extends Enum<Options>
Aviator Evaluator Configuration options.
  • Enum Constant Details

    • OPTIMIZE_LEVEL

      public static final Options OPTIMIZE_LEVEL
      Optimize level, default is AviatorEvaluator.EVAL
      See Also:
    • MATH_CONTEXT

      public static final Options MATH_CONTEXT
      Math context for decimal, default is
      invalid reference
      MathContext.DECIMAL128
      See Also:
    • ALWAYS_PARSE_FLOATING_POINT_NUMBER_INTO_DECIMAL

      public static final Options ALWAYS_PARSE_FLOATING_POINT_NUMBER_INTO_DECIMAL
      When true, always parsing floating-point number into BigDecial, default is false.It replaces
      invalid reference
      #ALWAYS_USE_DOUBLE_AS_DECIMAL
      option.
    • ALWAYS_PARSE_INTEGRAL_NUMBER_INTO_DECIMAL

      public static final Options ALWAYS_PARSE_INTEGRAL_NUMBER_INTO_DECIMAL
      When true, always parsing integral number into BigDecial, default is false.
      Since:
      4.2.0
    • TRACE_EVAL

      public static final Options TRACE_EVAL
      Whether to trace expression evaluating procedure, default is false.
    • PUT_CAPTURING_GROUPS_INTO_ENV

      public static final Options PUT_CAPTURING_GROUPS_INTO_ENV
      Whether to put capturing groups into passed-in env map when regular-expression pattern matches, default is true.If you don't want the groups, you can turn it off to get better performance in regular-expression pattern matching.
    • CAPTURE_FUNCTION_ARGS

      public static final Options CAPTURE_FUNCTION_ARGS
      Whether to capture the function arguments(at invocation) into env, the argument list will be stored in __args__ variable in env valid for function body. Default is false(disabled).
      Since:
      4.2.0
    • ENABLE_PROPERTY_SYNTAX_SUGAR

      public static final Options ENABLE_PROPERTY_SYNTAX_SUGAR
      Enable property access syntax sugar, use common-beantuils to access property such as "a.b.c" etc. Default value is true, enable this behaviour.
    • NIL_WHEN_PROPERTY_NOT_FOUND

      public static final Options NIL_WHEN_PROPERTY_NOT_FOUND
      When enable property access syntax sugar, returns nil if the property value is not found or throws exception.Default value is false,disabled this behaviour.
    • USE_USER_ENV_AS_TOP_ENV_DIRECTLY

      public static final Options USE_USER_ENV_AS_TOP_ENV_DIRECTLY
      Whether to use user passed-in env as top level environment directly.If true, it may make side effects(such as assignment) to user passed-in env., otherwise aviator will wrap the user passed-in env and does not make any side effects into it. Default is true.
    • MAX_LOOP_COUNT

      public static final Options MAX_LOOP_COUNT
      Max loop count to prevent too much CPU consumption. If it's value is zero or negative, it means no limitation on loop count.Default is zero.
    • FEATURE_SET

      public static final Options FEATURE_SET
      AviatorScript engine feature set, see Feature
      Since:
      5.
    • ALLOWED_CLASS_SET

      public static final Options ALLOWED_CLASS_SET
      Allowed java class set in new statement and class's static method(fields) etc. It's null by default. Null ALLOWED_CLASS_SET and ASSIGNABLE_ALLOWED_CLASS_SET means all classes are allowed (default); Empty ALLOWED_CLASS_SET or ASSIGNABLE_ALLOWED_CLASS_SET means forbidding all classes.
      Since:
      5.2.2
    • ASSIGNABLE_ALLOWED_CLASS_SET

      public static final Options ASSIGNABLE_ALLOWED_CLASS_SET
      Allowed assignable java class set in new statement and class's static method(fields) etc. It's null by default. Null ALLOWED_CLASS_SET and ASSIGNABLE_ALLOWED_CLASS_SET means all classes are allowed (default); Empty ALLOWED_CLASS_SET or ASSIGNABLE_ALLOWED_CLASS_SET means forbidding all classes.
    • EVAL_MODE

      public static final Options EVAL_MODE
      Script engine evaluate mode, default is ASM mode.
    • SERIALIZABLE

      public static final Options SERIALIZABLE
      Whether the compiled expression is serializable. If true, the compiled expression will implement
      invalid reference
      jva.io.Serializable
      and can be encoded/decoded by java serialization.
    • EVAL_TIMEOUT_MS

      public static final Options EVAL_TIMEOUT_MS
      The expression execution timeout value in milliseconds. If the execution time exceeds this value, it will throw a TimeoutException. A value of zero or less indicates no timeout limitation, the default value is zero (no limitation).

      Note: this limitation is not strict and may hurt performance, it is only checked before:
      • Operator evaluating, such as add, sub etc.
      • Jumping in branches, such as loop and conditional clauses etc.
      • Function invocation
      So if the expression doesn't contains these clauses or trapped into a function invocation, the behavior may be not expected. Try its best, but no promises.
      Since:
      5.4.2
  • Field Details

    • FALSE_VALUE

      public static final Options.Value FALSE_VALUE
    • TRUE_VALUE

      public static final Options.Value TRUE_VALUE
    • ZERO_VALUE

      public static final Options.Value ZERO_VALUE
    • DEFAULT_MATH_CONTEXT

      public static final Options.Value DEFAULT_MATH_CONTEXT
    • EVAL_VALUE

      public static final Options.Value EVAL_VALUE
    • COMPILE_VALUE

      public static final Options.Value COMPILE_VALUE
    • FULL_FEATURE_SET

      private static final Options.Value FULL_FEATURE_SET
    • TRACE_EVAL_DEFAULT_VAL

      private static final boolean TRACE_EVAL_DEFAULT_VAL
    • ASM_MODE

      public static final Options.Value ASM_MODE
    • INTERPRETER_MODE

      public static final Options.Value INTERPRETER_MODE
    • NULL_CLASS_SET

      public static final Options.Value NULL_CLASS_SET
    • SYS_EVAL_MODE

      public static Options.Value SYS_EVAL_MODE
  • Constructor Details

    • Options

      private Options()
  • Method Details

    • values

      public static Options[] 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 Options 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
    • intoObject

      public Object intoObject(Options.Value val)
      Cast value union into java object.
      Parameters:
      val -
      Returns:
    • intoValue

      public Options.Value intoValue(Object val)
      Cast java object into value union.
      Parameters:
      val -
      Returns:
    • isValidValue

      public boolean isValidValue(Object val)
    • getDefaultValue

      public Object getDefaultValue()
      Returns the default value of option.
      Returns:
    • getDefaultValueObject

      public Options.Value getDefaultValueObject()
      Returns the default value object of option.
      Returns:
    • getDefaultEvalMode

      public static Options.Value getDefaultEvalMode()
    • getSystemEvalMode

      private static Options.Value getSystemEvalMode()