mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-11 04:54:30 +08:00
Adding JSONParserConfiguration for configuring the depth of nested maps
This commit is contained in:
29
src/main/java/org/json/JSONParserConfiguration.java
Normal file
29
src/main/java/org/json/JSONParserConfiguration.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package org.json;
|
||||
|
||||
/**
|
||||
* Configuration object for the JSON parser. The configuration is immutable.
|
||||
*/
|
||||
public class JSONParserConfiguration extends ParserConfiguration {
|
||||
|
||||
/**
|
||||
* We can override the default maximum nesting depth if needed.
|
||||
*/
|
||||
public static final int DEFAULT_MAXIMUM_NESTING_DEPTH = ParserConfiguration.DEFAULT_MAXIMUM_NESTING_DEPTH;
|
||||
|
||||
/**
|
||||
* Configuration with the default values.
|
||||
*/
|
||||
public JSONParserConfiguration() {
|
||||
this.maxNestingDepth = DEFAULT_MAXIMUM_NESTING_DEPTH;
|
||||
}
|
||||
|
||||
public JSONParserConfiguration(int maxNestingDepth) {
|
||||
this.maxNestingDepth = maxNestingDepth;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSONParserConfiguration clone() {
|
||||
return new JSONParserConfiguration(DEFAULT_MAXIMUM_NESTING_DEPTH);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user