Package com.benesult.vivjson
Class Config
java.lang.Object
com.benesult.vivjson.Config
Configuration of VivJson.
Environment: Java 9 or later
Last modified: 2025-04-04
- Author:
- Fumiaki Motegi (motegi@benesult.com)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConfig()
Makes configuration instance of default values.Config
(boolean enableStderr, boolean enableTagDetail, boolean enableOnlyJson, @Nullable String infinity, @Nullable String nan, int maxArraySize, int maxDepth, int maxLoopTimes) Makes configuration instance with all custom values.Makes configuration instance that is based on the given instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Enables only JSON.void
enableOnlyJson
(boolean enable) Enables only JSON.void
Enables that error message outputs into stderr.void
enableStderr
(boolean enable) Enables/disables that error message outputs into stderr.void
Enables that detail of error message's tag.void
enableTagDetail
(boolean enable) Enables that detail of error message's tag.boolean
Gets whether parsing target is limited only JSON or not.static boolean
getEnableOnlyJson
(@Nullable Config config) Gets whether parsing target is limited only JSON or not.boolean
Gets whether outputting error message into stderr is enable.static boolean
getEnableStderr
(@Nullable Config config) Gets whether outputting error message into stderr is enable.boolean
Gets whether detail of error message's tag is enable or not.static boolean
getEnableTagDetail
(@Nullable Config config) Gets whether detail of error message's tag is enable or not.@Nullable String
Gets infinity's string.static @Nullable String
getInfinity
(@Nullable Config config) Gets infinity's string.int
Gets maximum array/block size.static int
getMaxArraySize
(@Nullable Config config) Gets maximum array/block size.int
Gets maximum recursive called times of evaluate method.static int
getMaxDepth
(@Nullable Config config) Gets maximum recursive called times of evaluate method.int
Gets maximum loop times of "for", "while", and so on.static int
getMaxLoopTimes
(@Nullable Config config) Gets maximum loop times of "for", "while", and so on.@Nullable String
getNaN()
Gets NaN(Not a Number)'s string.static @Nullable String
Get NaN(Not a Number)'s string.void
setInfinity
(@Nullable String infinity) Sets infinity's string.void
setMaxArraySize
(int size) Sets maximum array/block size.void
setMaxDepth
(int depth) Set maximum recursive called times of evaluate method.void
setMaxLoopTimes
(int times) Sets maximum loop times of "for", "while", and so on.void
Sets NaN(Not a Number)'s string.
-
Field Details
-
SPEC_VERSION
Version of VivJson's specification. It is represented as <Major> "." <Minor> "." <Patch>. For example, "1.0.0".- See Also:
-
INTERPRETER_VERSION
Version of this interpreter. It is represented as <Major> "." <Minor> "." <Patch>. For example, "1.0.0".
This <Major> "." <Minor> is equal toSPEC_VERSION
's one.- See Also:
-
-
Constructor Details
-
Config
public Config()Makes configuration instance of default values. -
Config
Makes configuration instance that is based on the given instance.- Parameters:
config
- a configuration instance
-
Config
public Config(boolean enableStderr, boolean enableTagDetail, boolean enableOnlyJson, @Nullable String infinity, @Nullable String nan, int maxArraySize, int maxDepth, int maxLoopTimes) Makes configuration instance with all custom values.- Parameters:
enableStderr
- enabling stderr. When true is given, error message is outputted into stderr. Otherwise, it is not outputted.enableTagDetail
- enabling the detail of tag. When true is given, error message's tag contains either of "Lexer", "Parser", or "Evaluator".enableOnlyJson
- enabling only JSON. When true is given, the given data is parsed as JSON. In other words, script is disabled.infinity
- Infinity's representation of string. When string is given, Infinity is allowed in JSON. Then the given string is used to input/output Infinity from/to JSON. (Note that it is not surrounded with quotation mark.) Whennull
is given and Infinity is happen, error may be occurred.nan
- NaN (Not a Number)'s representation of string. When string is given, NaN (Not a Number) is allowed in JSON. Then the given string is used to input/output NaN from/to JSON. (Note that it is not surrounded with quotation mark.) Whennull
is given and NaN is happen, error may be occurred.maxArraySize
- maximum array/block sizemaxDepth
- maximum recursive called times of evaluate methodmaxLoopTimes
- maximum loop times of "for", "while", and so on
-
-
Method Details
-
enableStderr
public void enableStderr()Enables that error message outputs into stderr. -
enableStderr
public void enableStderr(boolean enable) Enables/disables that error message outputs into stderr.- Parameters:
enable
- enabling stderr. When True is given, error message is outputted into stderr. Otherwise, it is not outputted.
-
getEnableStderr
public boolean getEnableStderr()Gets whether outputting error message into stderr is enable.- Returns:
- outputting error message into stderr is enable or not
-
getEnableStderr
Gets whether outputting error message into stderr is enable.- Parameters:
config
- Instance of configuration. When it isnull
, default value is returned.- Returns:
- outputting error message into stderr is enable or not
-
enableTagDetail
public void enableTagDetail()Enables that detail of error message's tag. -
enableTagDetail
public void enableTagDetail(boolean enable) Enables that detail of error message's tag.- Parameters:
enable
- enabling the detail of tag. When true is given, error message's tag contains either of "Lexer", "Parser", or "Evaluator".
-
getEnableTagDetail
public boolean getEnableTagDetail()Gets whether detail of error message's tag is enable or not.- Returns:
- detail of error message's tag is enable or not.
-
getEnableTagDetail
Gets whether detail of error message's tag is enable or not.- Parameters:
config
- Instance of configuration. When it isnull
, default value is returned.- Returns:
- detail of error message's tag is enable or not.
-
enableOnlyJson
public void enableOnlyJson()Enables only JSON. -
enableOnlyJson
public void enableOnlyJson(boolean enable) Enables only JSON.- Parameters:
enable
- enabling only JSON. When true is given, the given data is parsed as JSON. In other words, script is disabled.
-
getEnableOnlyJson
public boolean getEnableOnlyJson()Gets whether parsing target is limited only JSON or not.- Returns:
- parsing target is limited only JSON or not.
-
getEnableOnlyJson
Gets whether parsing target is limited only JSON or not.- Parameters:
config
- Instance of configuration. When it isnull
, default value is returned.- Returns:
- parsing target is limited only JSON or not.
-
setInfinity
Sets infinity's string. When string is given, Infinity is allowed in JSON. Then the given string is used to input/output Infinity from/to JSON. (Note that it is not surrounded with quotation mark.) Whennull
is given and Infinity is happen, error may be occurred.- Parameters:
infinity
- Infinity's string ornull
.
-
getInfinity
Gets infinity's string.- Returns:
- Infinity's string or
null
. When this isnull
, Infinity is not allowed.
-
getInfinity
Gets infinity's string.- Parameters:
config
- Instance of configuration. When it isnull
, default value is returned.- Returns:
- Infinity's string or
null
. When this isnull
, Infinity is not allowed.
-
setNaN
Sets NaN(Not a Number)'s string. When string is given, NaN (Not a Number) is allowed in JSON. Then the given string is used to input/output NaN from/to JSON. (Note that it is not surrounded with quotation mark.) Whennull
is given and NaN is happen, error may be occurred.- Parameters:
nan
- NaN(Not a Number)'s string ornull
.
-
getNaN
Gets NaN(Not a Number)'s string.- Returns:
- NaN(Not a Number)'s string or
null
. When this isnull
, NaN is not allowed.
-
getNaN
Get NaN(Not a Number)'s string.- Parameters:
config
- Instance of configuration. When it isnull
, default value is returned.- Returns:
- NaN(Not a Number)'s string or
null
. When this isnull
, NaN is not allowed.
-
setMaxArraySize
public void setMaxArraySize(int size) Sets maximum array/block size.- Parameters:
size
- maximum array/block size
-
getMaxArraySize
public int getMaxArraySize()Gets maximum array/block size.- Returns:
- maximum array/block size
-
getMaxArraySize
Gets maximum array/block size.- Parameters:
config
- Instance of configuration. When it isnull
, default value is returned.- Returns:
- maximum array/block size
-
setMaxDepth
public void setMaxDepth(int depth) Set maximum recursive called times of evaluate method.- Parameters:
depth
- maximum recursive called times of evaluate method
-
getMaxDepth
public int getMaxDepth()Gets maximum recursive called times of evaluate method.- Returns:
- maximum recursive called times of evaluate method
-
getMaxDepth
Gets maximum recursive called times of evaluate method.- Parameters:
config
- Instance of configuration. When it isnull
, default value is returned.- Returns:
- maximum recursive called times of evaluate method
-
setMaxLoopTimes
public void setMaxLoopTimes(int times) Sets maximum loop times of "for", "while", and so on.- Parameters:
times
- maximum loop times of "for", "while", and so on
-
getMaxLoopTimes
public int getMaxLoopTimes()Gets maximum loop times of "for", "while", and so on.- Returns:
- maximum loop times of "for", "while", and so on
-
getMaxLoopTimes
Gets maximum loop times of "for", "while", and so on.- Parameters:
config
- Instance of configuration. When it isnull
, default value is returned.- Returns:
- maximum loop times of "for", "while", and so on
-