public class TypeGraphJsonPrintVisitor extends TypeGraphPrintVisitor
Title: Framework Support Library
Description: A visitor class, which is used for printing of a type graph
(see TypeGraph
) in JSON format.
{ fieldName: '/', typeName: 'top type name', fields: [ { fieldName: 'field name', typeName: 'type name', fields: [ { fieldName: 'field name', typeName: 'type name', fields: ... } ... ] } ... ] }
list
field will be in the following format
{ "fieldName" : "list field name", "typeName" : "list", "fields" : [ { "fieldName" : "value", "typeName" : "type of list element" } ] }
array
field will be in the following format
{ "fieldName" : "array field name", "typeName" : "type[]", "fields" : [ { "fieldName" : "value", "typeName" : "type of array element" } ] }
map
field will be in the following format
{ "fieldName" : "map field name", "typeName" : "map", "fields" : [ { "fieldName" : "key", "typeName" : "type of key" }, { "fieldName" : "value", "typeName" : "type of value" } ] }
Copyright: Copyright (c) 2015
Company: StreamScape Technologies
Constructor and Description |
---|
TypeGraphJsonPrintVisitor() |
Modifier and Type | Method and Description |
---|---|
void |
afterChildrenVisit(TypeGraph node,
int level)
This method is called from
TypeGraph.traverse(TypeGraphVisitor)
method after all the children of the specified node are
traversed together with subtrees. |
boolean |
visit(TypeGraph node,
int level)
Prints the current node of the tree including its modifiers, type and name
|
setOutput
public boolean visit(TypeGraph node, int level) throws TypeAnalyzerException
TypeGraphPrintVisitor
visit
in interface TypeGraphVisitor
visit
in class TypeGraphPrintVisitor
node
- The node which is currently traversed by
TypeGraph.traverse(TypeGraphVisitor)
methodlevel
- The level of the currently traversed node in the spanning
tree of the traversed TypeGraph
.TypeAnalyzerException
- If outputting to the current stream failed for the graph nodepublic void afterChildrenVisit(TypeGraph node, int level) throws TypeAnalyzerException
TypeGraphVisitor
TypeGraph.traverse(TypeGraphVisitor)
method after all the children of the specified node
are
traversed together with subtrees.afterChildrenVisit
in interface TypeGraphVisitor
afterChildrenVisit
in class TypeGraphPrintVisitor
node
- The node which children have just been traversed by
TypeGraph.traverse(TypeGraphVisitor)
method.level
- The level in the traversed TypeGraph
spanning
tree of the node, which children have just been traversed.TypeAnalyzerException
- If an error occurred when visiting the graph nodeCopyright © 2015-2024 StreamScape Technologies. All rights reserved.