Package com.googlecode.aviator
Enum Options
- java.lang.Object
-
- java.lang.Enum<Options>
-
- com.googlecode.aviator.Options
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOptions.ValueThe option's value union
-
Enum Constant Summary
Enum Constants Enum Constant Description ALLOWED_CLASS_SETAllowed java class set in new statement and class's static method(fields) etc.ALWAYS_PARSE_FLOATING_POINT_NUMBER_INTO_DECIMALWhen true, always parsing floating-point number into BigDecial, default is false.It replaces#ALWAYS_USE_DOUBLE_AS_DECIMALoption.ALWAYS_PARSE_INTEGRAL_NUMBER_INTO_DECIMALWhen true, always parsing integral number into BigDecial, default is false.ASSIGNABLE_ALLOWED_CLASS_SETAllowed assignable java class set in new statement and class's static method(fields) etc.CAPTURE_FUNCTION_ARGSWhether to capture the function arguments(at invocation) into env, the argument list will be stored in __args__ variable in env valid for function body.ENABLE_PROPERTY_SYNTAX_SUGAREnable property access syntax sugar, use common-beantuils to access property such as "a.b.c" etc.EVAL_MODEScript engine evaluate mode, default is ASM mode.EVAL_TIMEOUT_MSThe expression execution timeout value in milliseconds.FEATURE_SETAviatorScript engine feature set, seeFeatureMATH_CONTEXTMath context for decimal, default isMathContext.DECIMAL128MAX_LOOP_COUNTMax loop count to prevent too much CPU consumption.NIL_WHEN_PROPERTY_NOT_FOUNDWhen enable property access syntax sugar, returns nil if the property value is not found or throws exception.Default value is false,disabled this behaviour.OPTIMIZE_LEVELOptimize level, default isAviatorEvaluator.EVALPUT_CAPTURING_GROUPS_INTO_ENVWhether 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.SERIALIZABLEWhether the compiled expression is serializable.TRACE_EVALWhether to trace expression evaluating procedure, default is false.USE_USER_ENV_AS_TOP_ENV_DIRECTLYWhether 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.
-
Field Summary
Fields Modifier and Type Field Description static Options.ValueASM_MODEstatic Options.ValueCOMPILE_VALUEstatic Options.ValueDEFAULT_MATH_CONTEXTstatic Options.ValueEVAL_VALUEstatic Options.ValueFALSE_VALUEprivate static Options.ValueFULL_FEATURE_SETstatic Options.ValueINTERPRETER_MODEstatic Options.ValueNULL_CLASS_SETstatic Options.ValueSYS_EVAL_MODEprivate static booleanTRACE_EVAL_DEFAULT_VALstatic Options.ValueTRUE_VALUEstatic Options.ValueZERO_VALUE
-
Constructor Summary
Constructors Modifier Constructor Description privateOptions()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Options.ValuegetDefaultEvalMode()java.lang.ObjectgetDefaultValue()Returns the default value of option.Options.ValuegetDefaultValueObject()Returns the default value object of option.private static Options.ValuegetSystemEvalMode()java.lang.ObjectintoObject(Options.Value val)Cast value union into java object.Options.ValueintoValue(java.lang.Object val)Cast java object into value union.booleanisValidValue(java.lang.Object val)static OptionsvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static Options[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
OPTIMIZE_LEVEL
public static final Options OPTIMIZE_LEVEL
Optimize level, default isAviatorEvaluator.EVAL- See Also:
AviatorEvaluator.EVAL,AviatorEvaluator.COMPILE
-
MATH_CONTEXT
public static final Options MATH_CONTEXT
Math context for decimal, default isMathContext.DECIMAL128- See Also:
MathContext
-
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#ALWAYS_USE_DOUBLE_AS_DECIMALoption.
-
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, seeFeature- 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 implementjva.io.Serializableand 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 aTimeoutException. 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
- Since:
- 5.4.2
-
-
Field Detail
-
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
-
-
Method Detail
-
values
public static Options[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Options c : Options.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Options valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
intoObject
public java.lang.Object intoObject(Options.Value val)
Cast value union into java object.- Parameters:
val-- Returns:
-
intoValue
public Options.Value intoValue(java.lang.Object val)
Cast java object into value union.- Parameters:
val-- Returns:
-
isValidValue
public boolean isValidValue(java.lang.Object val)
-
getDefaultValue
public java.lang.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()
-
-