XDocletComments

Document Actions
last edited 3 years ago by amehrabyan

Sample code for xdoclet usage:

  package org.vcb.parts.sample;

  // buildap package classes
  import org.vcb.framework.model.*;

  /**
   * Sample Buildap part,
   * developed for learning purposes only,
   * it shows usage of part, in, out and inout pin declarations notation
   *
   *  author - Buildap Team
   *
   * @vscb.part
   *  configname="sample.HelloWorld"
   *
   * @vscb.outpin
   *  id="51"
   *  name="GREETING"
   *  description="Sample outpin: fires generated greeting message event"
   *
   * @vscb.parameter
   *  type="String"
   *  name="message"
   *  description="Greeting message data"
   */

  public class HelloWorld {

  /**
   * It is convinient to use and increases readibility when 'out' prefix
   * used in namings of outpin variables.
   */
  OutPin outGreeting = null;

  public HelloWorld() {

    try {
      // set meta id of out pin
      outGreeting = new OutPin(51);
    }
    catch (InstantiationException e) {
      e.printStackTrace();
    }
  } 

  /**
   * Sample inpin - uses outpin to fire out event
   *
   * @vscb.inpin
   *  id="1"
   *  name="hello"
   *
   * @param name String
   */
  public void sayHello(String name) {
    outGreeting.fireOutPin("" + name + " says, Hello World");
  }

  /**
   * Sample inoutpin, NOTE there is no notion of inout pin as it is.
   * This notion used only for internal part developer's usage.
   * And it is just conbination of one inpin and one outpin
   * (NOTE if out-id equal to id of existing outpin
   * then the same outpin will be used, otherwise new one will be created)
   *
   * @vscb.inoutpin
   * id="2"
   * name="hello2"
   * out-id="51"
   * out-name="GREETING"
   *
   * @param name String
   * @return String
   */
  public String sayHello2(String name) {
    return ("" + name + " says, Hello World");
  }

  }//

Autogenerated configuration file from usage of xDoclet tags @vscb.part, @vscb.inpin, @vscb.inoutpin etc.:

  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE part SYSTEM "file:/part.dtd">

  <!--
        Sample Buildap part's class, developed for learning purposes only, 
        it shows usage of part, in, out and inout pin declarations notation author - amehrabyan
  -->
  <part  name="HelloWorld"  classname="org.vcb.parts.sample.HelloWorld">
  <terminals>    
        <!--
                Sample inpin - uses outpin to fire out event
        -->
        <inpin id="1" name="hello" method-name="sayHello" >
                <!--
                        String
                -->
                <parameter type="java.lang.String" name="name" />
        </inpin>

        <!--
                Sample inoutpin, NOTE there is no notion of inout pin as it is. 
                This notion used only for internal part developer's usage. 
                And it is just conbination of one inpin and one outpin 
                (NOTE if out-id equal to id of existing outpin then the same outpin will be used, 
                otherwise new one will be created)
        -->
        <inoutpin id="2" name="hello2" method-name="sayHello2" out-id="51" out-name="GREETING" >
                <!--
                        String
                -->
                <parameter type="java.lang.String" name="name" />
                <!--
                        String
                -->
                <result type="java.lang.String" />
        </inoutpin>

        <!--
                Sample outpin: fires generated greeting message event
        -->
        <outpin id="51" name="GREETING" >
                <!--
                        Greeting message data
                -->
                <parameter type="String" name="message" />
        </outpin>

  </terminals>
  </part>