Class JavaParserJsonSerializer
java.lang.Object
com.github.javaparser.serialization.JavaParserJsonSerializer
Serializes an AST or a partial AST to JSON.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
excludes properties from meta model (except comment)static class
static class
static class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Serializes node and all its children into json.protected void
writeNonMetaProperties(Node node, javax.json.stream.JsonGenerator generator)
This method writes json for properties not included in meta model (i.e., RANGE and TOKEN_RANGE).protected void
writeRange(Node node, javax.json.stream.JsonGenerator generator)
protected void
writeToken(String name, JavaToken token, javax.json.stream.JsonGenerator generator)
protected void
writeTokens(Node node, javax.json.stream.JsonGenerator generator)
-
Constructor Details
-
JavaParserJsonSerializer
public JavaParserJsonSerializer()
-
-
Method Details
-
serialize
Serializes node and all its children into json. Any node siblings will be ignored.- Parameters:
node
- the node that will be the root level json objectgenerator
- the json-p generator for writing the json- See Also:
- json-p
-
writeNonMetaProperties
This method writes json for properties not included in meta model (i.e., RANGE and TOKEN_RANGE). This method could be overriden so that - for example - tokens are not written to json to save space -
writeRange
-
writeTokens
-
writeToken
-