Class JavaParserJsonSerializer
- java.lang.Object
-
- com.github.javaparser.serialization.JavaParserJsonSerializer
-
public class JavaParserJsonSerializer extends Object
Serializes an AST or a partial AST to JSON.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJavaParserJsonSerializer.JsonNodeexcludes properties from meta model (except comment)static classJavaParserJsonSerializer.JsonRangestatic classJavaParserJsonSerializer.JsonTokenstatic classJavaParserJsonSerializer.JsonTokenRange
-
Constructor Summary
Constructors Constructor Description JavaParserJsonSerializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidserialize(Node node, javax.json.stream.JsonGenerator generator)Serializes 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)
-
-
-
Method Detail
-
serialize
public void serialize(Node node, javax.json.stream.JsonGenerator generator)
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
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). This method could be overriden so that - for example - tokens are not written to json to save space
-
writeRange
protected void writeRange(Node node, javax.json.stream.JsonGenerator generator)
-
writeTokens
protected void writeTokens(Node node, javax.json.stream.JsonGenerator generator)
-
-