PartImlementation
last edited 3 years ago by amehrabyan
There are several ways to implement part in Java:
- Development of VCB part
- Inpin Method implementation
- Outpin Firing Implementation with OutPin? object
- Convert standard Java class into VCB part
- Using inout pins
- Convert JavaBeans into VCB part
- AOP
Example 1:
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");
}
}//
Take a look at VCB Parts paper