use of org.ballerinalang.docgen.model.Variable in project ballerina by ballerina-lang.
the class Generator method createDocForNode.
/**
* Create documentation for enums.
* @param enumNode ballerina enum node.
* @return documentation for enum.
*/
public static EnumDoc createDocForNode(EnumNode enumNode) {
String enumName = enumNode.getName().getValue();
List<Variable> enumerators = new ArrayList<>();
// Iterate through the enumerators
if (enumNode.getEnumerators().size() > 0) {
for (EnumNode.Enumerator enumerator : enumNode.getEnumerators()) {
String desc = fieldAnnotation((BLangNode) enumNode, (BLangNode) enumerator);
Variable variable = new Variable(enumerator.getName().getValue(), "", desc);
enumerators.add(variable);
}
}
return new EnumDoc(enumName, description((BLangNode) enumNode), new ArrayList<>(), enumerators);
}
use of org.ballerinalang.docgen.model.Variable in project ballerina by ballerina-lang.
the class Generator method createDocForNode.
/**
* Create documentation for connectors.
* @param connectorNode ballerina connector node.
* @return documentation for connectors.
*/
public static ConnectorDoc createDocForNode(BLangConnector connectorNode) {
String connectorName = connectorNode.getName().value;
List<Variable> parameters = new ArrayList<>();
List<Documentable> actions = new ArrayList<>();
// Iterate through the connector parameters
if (connectorNode.getParameters().size() > 0) {
for (BLangVariable param : connectorNode.getParameters()) {
String dataType = type(param);
String desc = paramAnnotation(connectorNode, param);
Variable variable = new Variable(param.getName().value, dataType, desc);
parameters.add(variable);
}
}
// Iterate through the actions of the connectors
if (connectorNode.getActions().size() > 0) {
for (BLangAction action : connectorNode.getActions()) {
actions.add(createDocForNode(action));
}
}
return new ConnectorDoc(connectorName, description(connectorNode), actions, parameters);
}
use of org.ballerinalang.docgen.model.Variable in project ballerina by ballerina-lang.
the class Generator method createDocForNode.
/**
* Create documentation for functions.
* @param functionNode ballerina function node.
* @return documentation for functions.
*/
public static FunctionDoc createDocForNode(BLangFunction functionNode) {
String functionName = functionNode.getName().value;
List<Variable> parameters = new ArrayList<>();
List<Variable> returnParams = new ArrayList<>();
// Iterate through the parameters
if (functionNode.getParameters().size() > 0) {
for (BLangVariable param : functionNode.getParameters()) {
String dataType = type(param);
String desc = paramAnnotation(functionNode, param);
Variable variable = new Variable(param.getName().value, dataType, desc);
parameters.add(variable);
}
}
// Iterate through the return types
if (functionNode.getReturnParameters().size() > 0) {
for (int i = 0; i < functionNode.getReturnParameters().size(); i++) {
BLangVariable returnParam = functionNode.getReturnParameters().get(i);
String dataType = type(returnParam);
String desc = returnParamAnnotation(functionNode, i);
Variable variable = new Variable(returnParam.getName().value, dataType, desc);
returnParams.add(variable);
}
}
return new FunctionDoc(functionName, description(functionNode), new ArrayList<>(), parameters, returnParams);
}
use of org.ballerinalang.docgen.model.Variable in project ballerina by ballerina-lang.
the class Generator method createDocForNode.
/**
* Create documentation for annotations.
* @param annotationNode ballerina annotation node.
* @return documentation for annotation.
*/
public static AnnotationDoc createDocForNode(BLangAnnotation annotationNode) {
String annotationName = annotationNode.getName().getValue();
List<Variable> attributes = new ArrayList<>();
// Iterate through the attributes of the annotation
if (annotationNode.getAttributes().size() > 0) {
for (BLangAnnotAttribute annotAttribute : annotationNode.getAttributes()) {
String dataType = getTypeName(annotAttribute.getTypeNode());
String desc = annotFieldAnnotation(annotationNode, annotAttribute);
Variable variable = new Variable(annotAttribute.getName().value, dataType, desc);
attributes.add(variable);
}
}
return new AnnotationDoc(annotationName, description(annotationNode), new ArrayList<>(), attributes);
}
use of org.ballerinalang.docgen.model.Variable in project ballerina by ballerina-lang.
the class Generator method createDocForNode.
/**
* Create documentation for actions.
* @param actionNode ballerina action node.
* @return documentation for actions.
*/
public static ActionDoc createDocForNode(BLangAction actionNode) {
String actionName = actionNode.getName().value;
List<Variable> parameters = new ArrayList<>();
List<Variable> returnParams = new ArrayList<>();
// Iterate through the parameters
if (actionNode.getParameters().size() > 0) {
for (BLangVariable param : actionNode.getParameters()) {
String dataType = type(param);
String desc = paramAnnotation(actionNode, param);
Variable variable = new Variable(param.getName().value, dataType, desc);
parameters.add(variable);
}
}
// Iterate through the return types
if (actionNode.getReturnParameters().size() > 0) {
for (int i = 0; i < actionNode.getReturnParameters().size(); i++) {
BLangVariable returnParam = actionNode.getReturnParameters().get(i);
String dataType = type(returnParam);
String desc = returnParamAnnotation(actionNode, i);
Variable variable = new Variable(returnParam.getName().value, dataType, desc);
returnParams.add(variable);
}
}
return new ActionDoc(actionName, description(actionNode), new ArrayList<>(), parameters, returnParams);
}
Aggregations