Examples of IInterface


Examples of org.destecs.tools.jprotocolgenerator.ast.IInterface

  {
    String interfaceName = null;
    String outputFolder = null;

    StringBuffer sb = new StringBuffer();
    IInterface interfaceNode = new IInterface();
    String outputFileName = "";
   
      String packageName = "org.destecs.protocol";
      String xmlFilePath = args[0];

      if (args.length == 4)
      {
        interfaceName = args[1];
        packageName = args[2];
        outputFolder = args[3];
      }

      System.out.println("Interface Generation:");
      System.out.println("\tInterfaceName: " + interfaceName);
      System.out.println("\tPackageName: " + packageName);
      System.out.println("\tInput Xml: " + xmlFilePath);
      System.out.println("\tOutput folder: " + outputFolder);

      File file = new File(xmlFilePath);
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      DocumentBuilder db = dbf.newDocumentBuilder();
      Document doc = db.parse(file);
      doc.getDocumentElement().normalize();

      outputFileName = cleanName(doc.getDocumentElement().getNodeName());

      interfaceNode.packageName = packageName;
      sb.append("package " + packageName + ";");

      sb.append("\n");

      interfaceNode.imports.add(new Type(Map.class));
      interfaceNode.imports.add(new Type(List.class));
      interfaceNode.imports.add(new RpcMethodType());

      sb.append("\nimport " + Map.class.getName() + ";");
      sb.append("\nimport " + List.class.getName() + ";");
      sb.append("\n");
      if (interfaceName == null && outputFileName!=null)
      {
        interfaceName = "I" + outputFileName;
      }else
      {
        interfaceName = "ICoSimProtocol";
      }

      interfaceNode.setName(interfaceName);

      sb.append("\npublic interface " + interfaceName);
      sb.append("\n{");

      NodeList nodeLst = doc.getElementsByTagName("method");

      for (int s = 0; s < nodeLst.getLength(); s++)
      {

        Node fstNode = nodeLst.item(s);

        if (fstNode.getNodeType() == Node.ELEMENT_NODE)
        {

          Element fstElmnt = (Element) fstNode;

          sb.append("\n\t");
          // sb.append(getMethodSignature(fstElmnt));
          interfaceNode.definitions.add(getMethodSignature(fstElmnt));
          sb.append("\n");

        }

      }
      sb.append("\n}");
      sb = new StringBuffer();
      sb.append(interfaceNode.toSource());
   

//    System.out.println(sb.toString());
//
//    System.out.println("\n\n");
View Full Code Here

Examples of org.destecs.tools.jprotocolgenerator.ast.IInterface

    List<IInterface> interfaces = new Vector<IInterface>();
    List<Method> medthods = new Vector<Method>();
    for (String group : groups)
    {
      IInterface intf = new IInterface();
      intf.imports = interfaceNode.imports;
      intf.packageName = interfaceNode.packageName;
      intf.setName(getValidJavaName("I"
          + firstCharToUpper(makeJavaName(group), true)));
      for (Method m : interfaceNode.definitions)
      {
        if (m.group != null && m.group.equals(group))
        {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.