Package com.puppetlabs.geppetto.forge.model

Examples of com.puppetlabs.geppetto.forge.model.NamedTypeItem


        name = entry.getElement().toStringOrNull();
      else if("doc".equals(key))
        doc = entry.getElement().toStringOrNull();
    }
    if(name != null) {
      NamedTypeItem item = new NamedTypeItem();
      item.setName(name);
      item.setDocumentation(doc);
      return item;
    }
    return null;
  }
View Full Code Here


        symArgs = RubyParserUtils.findNodes(call.getArgs(), new NodeType[] { NodeType.SYMBOLNODE });
        if(symArgs.isEmpty())
          continue;

        NamedTypeItem provider = new NamedTypeItem();
        provider.setName(((SymbolNode) symArgs.get(0)).getName());
        if(providers == null)
          providers = new ArrayList<NamedTypeItem>();
        providers.add(provider);

        List<Node> calls = RubyParserUtils.findNodes(call.getIter(), new NodeType[] {
            NodeType.BLOCKNODE, NodeType.FCALLNODE });
        if(calls.isEmpty())
          calls = RubyParserUtils.findNodes(call.getIter(), new NodeType[] { NodeType.FCALLNODE });
        if(!calls.isEmpty()) {
          for(Node snode : calls) {
            FCallNode subCall = (FCallNode) snode;
            if("desc".equals(subCall.getName())) {
              List<Node> strArgs = RubyParserUtils.findNodes(
                subCall.getArgs(), new NodeType[] { NodeType.STRNODE });
              if(strArgs.size() >= 1)
                provider.setDocumentation(((StrNode) strArgs.get(0)).getValue());
              break;
            }
          }
        }
      }
View Full Code Here

      List<Node> pnodes = RubyParserUtils.findNodes(callNode.getArgs(), new NodeType[] { NodeType.SYMBOLNODE });
      if(pnodes.size() != 1)
        throw new IOException("A newparam or newproperty call does not take exactly one symbol parameter in " +
            typeFileStr);

      NamedTypeItem elem = new NamedTypeItem();
      if(isParam) {
        if(parameters == null)
          parameters = new ArrayList<NamedTypeItem>();
        parameters.add(elem);
      }
      else {
        if(properties == null)
          properties = new ArrayList<NamedTypeItem>();
        properties.add(elem);
      }

      elem.setName(((SymbolNode) pnodes.get(0)).getName());
      iterNode = callNode.getIter();
      pnodes = RubyParserUtils.findNodes(iterNode, new NodeType[] { NodeType.BLOCKNODE, NodeType.FCALLNODE });
      if(pnodes.isEmpty())
        // No block when there's just one call
        pnodes = RubyParserUtils.findNodes(iterNode, new NodeType[] { NodeType.FCALLNODE });

      for(Node pnode : pnodes) {
        FCallNode pcallNode = (FCallNode) pnode;
        if("desc".equals(pcallNode.getName())) {
          List<Node> args = pcallNode.getArgs().childNodes();
          if(args.size() != 1)
            throw new IOException(
              "A newparam or newproperty desc call does not take exactly one parameter in " + typeFileStr);
          elem.setDocumentation(RubyParserUtils.stringValue(args.get(0)));
          break;
        }
      }
    }
    type.setParameters(parameters);
View Full Code Here

TOP

Related Classes of com.puppetlabs.geppetto.forge.model.NamedTypeItem

Copyright © 2018 www.massapicom. 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.