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 classexcludes properties from meta model (except comment)static classstatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSerializes node and all its children into json.protected voidwriteNonMetaProperties(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 voidwriteRange(Node node, javax.json.stream.JsonGenerator generator)protected voidwriteToken(String name, JavaToken token, javax.json.stream.JsonGenerator generator)protected voidwriteTokens(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
-