public class ExplorationGenerator extends Object implements IGenerator
handlers package
for implemented handlers.Modifier and Type | Field and Description |
---|---|
static Optional<Object> |
EMPTY_VALUE_DUE_TO_MAX_DEPTH |
Constructor and Description |
---|
ExplorationGenerator(IHandler stringHandler,
IHandler integerHandler,
IHandler numberHandler,
IHandler booleanHandler,
IHandler enumHandler,
IHandler objectHandler,
IHandler arrayHandler) |
Modifier and Type | Method and Description |
---|---|
Iterator<org.json.JSONObject> |
createIterator(JSONSchema schema,
int maxDocumentDepth,
boolean canGenerateInvalid)
Creates an iterator over the documents this generator can produce up to the
given document depth.
|
org.json.JSONObject |
generateDocument(JSONSchema schema,
int maxDocumentDepth,
boolean canGenerateInvalid,
ChoicesSequence choices) |
Optional<Object> |
generateValueAccordingToConstraints(JSONSchema schema,
int maxDocumentDepth,
boolean canGenerateInvalid,
ChoicesSequence choices)
Generates a value according to the constraints given in the schema and
following the sequence of choices.
|
Optional<Object> |
generateValueAccordingToConstraints(JSONSchema schema,
int maxDocumentDepth,
boolean canGenerateInvalid,
ChoicesSequence choices,
boolean mustBeObject) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createIterator, createIterator, createIterator
public Iterator<org.json.JSONObject> createIterator(JSONSchema schema, int maxDocumentDepth, boolean canGenerateInvalid)
IGenerator
next()
.
The depth of the documents is bounded, i.e., in any document, there can only
be at most maxDocumentDepth
nested objects and arrays.
Note that if the bound is set too low, only invalid documents may be
generated as the deepest objects or arrays may not be correct.
In particular, no documents will be generated with a depth of zero.
Invalid documents can be generated if canGenerateInvalid
is
true
.
Note that valid documents can still be generated, no matter the value of
canGenerateInvalid
.createIterator
in interface IGenerator
schema
- The schemamaxDocumentDepth
- The maximal depth of the documentscanGenerateInvalid
- Whether invalid documents can be generatedpublic org.json.JSONObject generateDocument(JSONSchema schema, int maxDocumentDepth, boolean canGenerateInvalid, ChoicesSequence choices) throws org.json.JSONException, JSONSchemaException
org.json.JSONException
JSONSchemaException
public Optional<Object> generateValueAccordingToConstraints(JSONSchema schema, int maxDocumentDepth, boolean canGenerateInvalid, ChoicesSequence choices) throws org.json.JSONException, JSONSchemaException
schema
- The schemamaxDocumentDepth
- The maximal depth of the documentchoices
- The sequence of choicesorg.json.JSONException
JSONSchemaException
public Optional<Object> generateValueAccordingToConstraints(JSONSchema schema, int maxDocumentDepth, boolean canGenerateInvalid, ChoicesSequence choices, boolean mustBeObject) throws org.json.JSONException, JSONSchemaException
org.json.JSONException
JSONSchemaException
Copyright © 2022. All rights reserved.