Package org.openhab.core.scriptengine.action

Examples of org.openhab.core.scriptengine.action.ActionDoc


        }
         return super.getDocumentation(o);
  }

  private String getDocumentation(Method m) {
    ActionDoc actionDoc = m.getAnnotation(ActionDoc.class);
    if(actionDoc!=null) {
      StringBuilder sb = new StringBuilder();
      sb.append("<p>&nbsp;&nbsp;&nbsp;" + actionDoc.text() + "</p>");
      if(m.getParameterTypes().length > 0) {
        sb.append("<p><b>Parameters:</b><br>");
        List<String> params = new ArrayList<String>();
        for(int i = 0; i< m.getParameterTypes().length; i++) {
          ParamDoc paramDoc = getParamDoc(m, i);
          String paramName = paramDoc!=null ? paramDoc.name() : "p" + i;
          params.add("&nbsp;&nbsp;&nbsp;" + paramName + (StringUtils.isEmpty(paramDoc.text()) ? "" : ": " + paramDoc.text()));
        }
        sb.append(StringUtils.join(params, "<br/>"));
        sb.append("</p>");
      }
      if(!StringUtils.isEmpty(actionDoc.returns())) {
        sb.append("<p><b>Returns:</b><br>");
        sb.append("&nbsp;&nbsp;&nbsp;" + actionDoc.returns() + "<p>");
      }
      return sb.toString();
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.openhab.core.scriptengine.action.ActionDoc

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.