IBM WebSphere Multichannel Bank Transformation Toolkit, Version 7.1

Using bean converter for simple data types

You can use bean property converter to perform conversion between string and simple data type.

General steps

During analysis and design phase, define bean collection and related POJO as data element, which contains some simple Java objects as attributes, such as primitive types. Once need to set string value into non-string data element, such as int or char, invoke the set value method of context directly. The toolkit automatically performs the conversion according to the type of predefined attributes.

Converting string value to simple attributes

Use the following code to
Context beanCtx = (Context)ContextFactory.createContext("customerCtx");
beanCtx.setValueAt("customer.id", "12345");

Defining POJO element with simple attributes

Use the following code to define a POJO element Customer.
package com.ibm.btt.typeconverter.bean;

public class Customer {

	// define attributes of customer
	private String name;
	private int id;
	

	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return name;
	}
	public void setId(int id) {
		this.id = id;
	}
	public int getId() {
		return id;
	}
}


Feedback