Java Bean Generator

Click here to download the file. The cost of this software is $5.00. Please send money to:
Steve Warsa
16654 S. 25th Street
Phoenix, AZ 85048

Instructions:

This jar file should be placed in the jre/lib/ext directory of your java installation. The usage instructions can be printed by running the command: java EntityBeanUtil. This is what you will see:

usage: java EntityBeanUtil <-n bean_name> [-p ] [-i ] [-ii ] [-e ] [] ...

So, the following command will create a Java Bean named 'MyBean':

java EntityBeanUtil -n MyBean -p first.bean String,field1 int,field2 byte[],field3

will create a file called MyBean.java in a directory relative to the current directory 'first/bean' with 3 fields, getters and setters for all 3, 2 constructors (one with no params, one with all params), in the package first.bean with toString method and toHTMLRow method. Below is the source code that is created:


package first.bean;

public class MyBean {

	private String field1;
	private int field2;
	private byte[] field3;

	public MyBean( 
		String field1, 
		int field2, 
		byte[] field3 ) {

		this.field1 = field1;
		this.field2 = field2;
		this.field3 = field3;
	}

	public MyBean() {
	}

	public void setField1( String field1 ) {
		this.field1 = field1;
	}

	public String getField1() {
		return field1;
	}

	public void setField2( int field2 ) {
		this.field2 = field2;
	}

	public int getField2() {
		return field2;
	}

	public void setField3( byte[] field3 ) {
		this.field3 = field3;
	}

	public byte[] getField3() {
		return field3;
	}

	public String toString() {
		return 
			"field1 = " + field1 + ", " +
			"field2 = " + field2 + ", " +
			"field3 = " + field3;
	}
	public String toHTMLRow() {
		return "" + 
			"" + field1 + "" +
			"" + field2 + "" +
			"" + field3 + "";
	}
}