Package ch.ralscha.extdirectspring.bean.api

Examples of ch.ralscha.extdirectspring.bean.api.ActionDoc


    assertThat(doc.getReturnMethod()).isEmpty();
  }

  @Test
  public void testDoc4() throws Exception {
    ActionDoc doc = callApi("method4");

    assertThat(doc.isDeprecated()).isFalse();
    assertThat(doc.getMethodComment()).isEqualTo("method four doc");
    assertThat(doc.getAuthor()).isEqualTo("sr");
    assertThat(doc.getVersion()).isEqualTo("0.4");
    assertThat(doc.getParameters()).isEmpty();
    assertThat(doc.getReturnMethod()).isEmpty();
  }
View Full Code Here


    assertThat(doc.getReturnMethod()).isEmpty();
  }

  @Test
  public void testDoc5() throws Exception {
    ActionDoc doc = callApi("method5");

    assertThat(doc.isDeprecated()).isTrue();
    assertThat(doc.getMethodComment()).isEqualTo("method five doc");
    assertThat(doc.getAuthor()).isEqualTo("dbs");
    assertThat(doc.getVersion()).isEqualTo("0.5");
    assertThat(doc.getParameters()).isEmpty();
    assertThat(doc.getReturnMethod()).isEmpty();
  }
View Full Code Here

    assertThat(doc.getReturnMethod()).isEmpty();
  }

  @Test
  public void testDoc6() throws Exception {
    ActionDoc doc = callApi("method6");

    assertThat(doc.isDeprecated()).isFalse();
    assertThat(doc.getMethodComment()).isEqualTo("method six doc");
    assertThat(doc.getAuthor()).isEqualTo("sr");
    assertThat(doc.getVersion()).isEqualTo("0.6");
    assertThat(doc.getParameters()).isEmpty();
    assertThat(doc.getReturnMethod()).isEmpty();
  }
View Full Code Here

    assertThat(doc.getReturnMethod()).isEmpty();
  }

  @Test
  public void testDoc7() throws Exception {
    ActionDoc doc = callApi("method7");

    assertThat(doc.isDeprecated()).isTrue();
    assertThat(doc.getMethodComment()).isEqualTo("method seven doc");
    assertThat(doc.getAuthor()).isEqualTo("sr");
    assertThat(doc.getVersion()).isEqualTo("0.7");
    assertThat(doc.getParameters()).isEmpty();
    assertThat(doc.getReturnMethod()).hasSize(1);
    assertThat(doc.getReturnMethod()).contains(entry("p1", "p1 desc"));
  }
View Full Code Here

    assertThat(doc.getReturnMethod()).contains(entry("p1", "p1 desc"));
  }

  @Test
  public void testDoc8() throws Exception {
    ActionDoc doc = callApi("method8");

    assertThat(doc.isDeprecated()).isFalse();
    assertThat(doc.getMethodComment()).isEqualTo("method eight doc");
    assertThat(doc.getAuthor()).isEqualTo("sr");
    assertThat(doc.getVersion()).isEqualTo("0.8");
    assertThat(doc.getParameters()).isEmpty();
    assertThat(doc.getReturnMethod()).hasSize(2);
    assertThat(doc.getReturnMethod()).contains(entry("p1", "p1 desc"),
        entry("p2", "p2 desc"));
  }
View Full Code Here

        entry("p2", "p2 desc"));
  }

  @Test
  public void testDoc9() throws Exception {
    ActionDoc doc = callApi("method9");

    assertThat(doc.isDeprecated()).isFalse();
    assertThat(doc.getMethodComment()).isEqualTo("method nine doc");
    assertThat(doc.getAuthor()).isEqualTo("dbs");
    assertThat(doc.getVersion()).isEqualTo("0.9");
    assertThat(doc.getParameters()).isEmpty();
    assertThat(doc.getReturnMethod()).isEmpty();
  }
View Full Code Here

    assertThat(doc.getReturnMethod()).isEmpty();
  }

  @Test
  public void testDoc10() throws Exception {
    ActionDoc doc = callApi("method10");

    assertThat(doc.isDeprecated()).isFalse();
    assertThat(doc.getMethodComment()).isEqualTo("method ten doc");
    assertThat(doc.getAuthor()).isEqualTo("sr");
    assertThat(doc.getVersion()).isEqualTo("1.0");
    assertThat(doc.getParameters()).hasSize(1);
    assertThat(doc.getParameters()).contains(entry("a", "a desc"));
    assertThat(doc.getReturnMethod()).hasSize(2);
    assertThat(doc.getReturnMethod()).contains(entry("p1", "p1 desc"),
        entry("p2", "p2 desc"));

  }
View Full Code Here

   * @param documentation
   * @return ActionDoc
   */
  private Action extractDocumentationAnnotations(ExtDirectMethodDocumentation documentation) {
    if (!documentation.value().isEmpty()) {
      ActionDoc actionDoc = new ActionDoc(getAction(), documentation.value(), documentation.author(),
          documentation.version(), documentation.deprecated());
      ExtDirectDocParameters docParameters = documentation.parameters();
      if (null != docParameters) {
        String[] params = docParameters.params();
        String[] descriptions = docParameters.descriptions() == null ? new String[params.length]
            : docParameters.descriptions();
        if (params.length == descriptions.length) {
          for (int i = 0; i < params.length; i++) {
            actionDoc.getParameters().put(params[i],
                descriptions[i] == null ? "No description" : descriptions[i]);
          }
        } else {
          LogFactory
              .getLog(MethodInfo.class)
              .info("Documentation: skip generation of parameters, params size is different from descriptions size");
        }
      }
      ExtDirectDocReturn docReturn = documentation.returnMethod();
      if (null != docReturn) {
        String[] properties = docReturn.properties();
        String[] descriptions = docReturn.descriptions() == null ? new String[properties.length] : docReturn
            .descriptions();
        if (properties.length == descriptions.length) {
          for (int i = 0; i < properties.length; i++) {
            actionDoc.getReturnMethod().put(properties[i],
                descriptions[i] == null ? "No description" : descriptions[i]);
          }
        } else {
          LogFactory
              .getLog(MethodInfo.class)
View Full Code Here

   * @param documentation
   * @return ActionDoc
   */
  private Action extractDocumentationAnnotations(ExtDirectMethodDocumentation documentation) {
    if (!documentation.value().isEmpty()) {
      ActionDoc actionDoc = new ActionDoc(getAction(), documentation.value(), documentation.author(),
          documentation.version(), documentation.deprecated());
      ExtDirectDocParameters docParameters = documentation.parameters();
      if (null != docParameters) {
        String[] params = docParameters.params();
        String[] descriptions = docParameters.descriptions() == null ? new String[params.length]
            : docParameters.descriptions();
        if (params.length == descriptions.length) {
          for (int i = 0; i < params.length; i++) {
            actionDoc.getParameters().put(params[i],
                descriptions[i] == null ? "No description" : descriptions[i]);
          }
        } else {
          LogFactory
              .getLog(MethodInfo.class)
              .info("Documentation: skip generation of parameters, params size is different from descriptions size");
        }
      }
      ExtDirectDocReturn docReturn = documentation.returnMethod();
      if (null != docReturn) {
        String[] properties = docReturn.properties();
        String[] descriptions = docReturn.descriptions() == null ? new String[properties.length] : docReturn
            .descriptions();
        if (properties.length == descriptions.length) {
          for (int i = 0; i < properties.length; i++) {
            actionDoc.getReturnMethod().put(properties[i],
                descriptions[i] == null ? "No description" : descriptions[i]);
          }
        } else {
          LogFactory
              .getLog(MethodInfo.class)
View Full Code Here

          // mode
          if (jgen.getPrettyPrinter() != null && action instanceof ActionDoc) {// insertion
                                              // of
                                              // doc
                                              // here
            ActionDoc actionDoc = (ActionDoc) action;
            jgen.writeRaw("\n\t/**");
            if (actionDoc.isDeprecated()) {
              jgen.writeRaw("\n\t* @deprecated");
            }
            jgen.writeRaw("\n\t* " + actionDoc.getName() + ": " + actionDoc.getMethodComment());
            jgen.writeRaw("\n\t* @author: " + actionDoc.getAuthor());
            jgen.writeRaw("\n\t* @version: " + actionDoc.getVersion());
            jgen.writeRaw("\n\t*");
            for (Entry<String, String> entry2 : actionDoc.getParameters().entrySet()) {
              jgen.writeRaw("\n\t* @param: [" + entry2.getKey() + "] " + entry2.getValue());
            }
            jgen.writeRaw("\n\t* @return");
            for (Entry<String, String> entry2 : actionDoc.getReturnMethod().entrySet()) {
              jgen.writeRaw("\n\t*\t [" + entry2.getKey() + "] " + entry2.getValue());
            }
            jgen.writeRaw("\n\t*/\n");
          }
          jgen.writeObject(action);
 
View Full Code Here

TOP

Related Classes of ch.ralscha.extdirectspring.bean.api.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.