Search in sources :

Example 16 with ApiField

use of com.emc.apidocs.model.ApiField in project coprhd-controller by CoprHD.

the class Utils method dump.

public static void dump(ApiMethod apiMethod) {
    System.out.println("=================================");
    System.out.println(apiMethod.httpMethod + " " + apiMethod.path);
    System.out.println("JavaMethod:" + apiMethod.javaMethodName);
    System.out.println("Brief: " + apiMethod.brief);
    System.out.println("Description:" + apiMethod.description);
    System.out.println("\nPATH PARAMETERS:");
    for (ApiField param : apiMethod.pathParameters) {
        System.out.println("- [" + param.name + "] " + param.description);
    }
    System.out.println("\nQUERY PARAMETERS");
    for (ApiField param : apiMethod.queryParameters) {
        System.out.println("- [" + param.name + "] " + param.description);
    }
    System.out.println("\nROLES:");
    for (String role : apiMethod.roles) {
        System.out.println("- " + role);
    }
    System.out.println("\nACLS:");
    for (String acl : apiMethod.acls) {
        System.out.println("- " + acl);
    }
    if (apiMethod.input != null) {
        System.out.println("INPUT: " + apiMethod.input.name);
    }
    if (apiMethod.output != null) {
        System.out.println("OUTPUT: " + apiMethod.output.name);
        dumpAsXml(apiMethod.output, 0);
    }
}
Also used : ApiField(com.emc.apidocs.model.ApiField)

Example 17 with ApiField

use of com.emc.apidocs.model.ApiField in project coprhd-controller by CoprHD.

the class Utils method generateJSON.

public static String generateJSON(ApiClass element, StringBuffer buffer) {
    buffer.append("{\n");
    int counter = 0;
    for (ApiField field : element.fields) {
        generateJSON(field, buffer);
        counter++;
        if (counter < element.fields.size()) {
            buffer.append(",\n");
        }
    }
    buffer.append("}");
    return buffer.toString();
}
Also used : ApiField(com.emc.apidocs.model.ApiField)

Example 18 with ApiField

use of com.emc.apidocs.model.ApiField in project coprhd-controller by CoprHD.

the class EnunciateFileReader method toApiClass.

private ApiClass toApiClass(Node typeNode) {
    ApiClass apiClass = new ApiClass();
    apiClass.name = XMLUtils.getNodeText(typeNode, EnunciateConstants.TYPE_NAME);
    NodeList elementList = XMLUtils.getNodeList(typeNode, EnunciateConstants.TYPE_ELEMENT);
    for (int f = 0; f < elementList.getLength(); f++) {
        Node element = elementList.item(f);
        apiClass.addField(toApiField(element));
    }
    NodeList attributeList = XMLUtils.getNodeList(typeNode, EnunciateConstants.TYPE_ATTRIBUTE);
    for (int f = 0; f < attributeList.getLength(); f++) {
        Node attribute = attributeList.item(f);
        String attributeType = XMLUtils.getNodeText(attribute, EnunciateConstants.ATTRIBUTE_TYPE);
        String attributeName = XMLUtils.getNodeText(attribute, EnunciateConstants.ATTRIBUTE_NAME);
        ApiField attributeField = new ApiField();
        attributeField.name = attributeName;
        attributeField.primitiveType = attributeType;
        apiClass.addAttribute(attributeField);
    }
    return apiClass;
}
Also used : NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) ApiClass(com.emc.apidocs.model.ApiClass) ApiField(com.emc.apidocs.model.ApiField)

Aggregations

ApiField (com.emc.apidocs.model.ApiField)18 FieldSpec (com.squareup.javapoet.FieldSpec)4 ApiClass (com.emc.apidocs.model.ApiClass)3 ImmutableList (com.google.common.collect.ImmutableList)3 Builder (com.google.common.collect.ImmutableList.Builder)2 ParamTag (com.sun.javadoc.ParamTag)2 Matcher (java.util.regex.Matcher)2 CustomServicesConstants (com.emc.storageos.primitives.CustomServicesConstants)1 BasicInputParameter (com.emc.storageos.primitives.input.BasicInputParameter)1 InputParameter (com.emc.storageos.primitives.input.InputParameter)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ClassDoc (com.sun.javadoc.ClassDoc)1 FieldDoc (com.sun.javadoc.FieldDoc)1 MemberDoc (com.sun.javadoc.MemberDoc)1 MethodDoc (com.sun.javadoc.MethodDoc)1 Parameter (com.sun.javadoc.Parameter)1 Tag (com.sun.javadoc.Tag)1 List (java.util.List)1 Map (java.util.Map)1 Node (org.w3c.dom.Node)1