com.codestreet.messageforge
Class ConverterBeanAndJMS

java.lang.Object
  extended bycom.codestreet.messageforge.Converter
      extended bycom.codestreet.messageforge.ConverterBeanAndJMS

public abstract class ConverterBeanAndJMS
extends Converter

Converter class for (Java) Beans.

A bean must satisfy the following requirements: it must have a no-arg constructor, all properties that it wishes to be marshalled must have public get/set methods, the get and set methods must follow the design pattern getXXX() or GetXXX()and setXXX() or SetXXX(), and the set methods must take one arg.

Bean properties can primitive types (e.g. int), wrappers of primitive types (e.g. Integer), arrays of primitives (e.g. int[]), arrays of primitive wrappers (e.g. Integer[]), String, Date, BigDecimal,, String[], Date[], BigDecimal[], nested beans and arrays of nested beans.

This implementation assumes that the following JMS extensions are supported by the JMS provider: Nested messages are allowed, arrays of primitive types are allowed, and arrays of wrappers of primitive types are allowed. All these assumptions are valid for TIBCO's E4JMS.

Author:
jawaid.hakim

Constructor Summary
ConverterBeanAndJMS()
           
 
Method Summary
static javax.jms.MapMessage marshal(java.lang.Object bean, javax.jms.Session session)
          Marshal a bean into a JMS message.
static java.lang.Object unmarshal(javax.jms.MapMessage source)
          Unmarshal a bean from a JMS message.
static java.lang.Object unmarshal(javax.jms.MapMessage source, java.lang.String beanName, java.lang.String fullName)
          Unmarshal a bean from a JMS message.
 
Methods inherited from class com.codestreet.messageforge.Converter
createMsgObject, createMsgObject, dateToDouble, dateToLong, dateToStr, getBeanValidator, getLenient, getVersion, setBeanValidator, setDateFromDouble, setDateFromLong, setDateFromStr, setDefaultFactory, setMaximumFractionDigits
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConverterBeanAndJMS

public ConverterBeanAndJMS()
Method Detail

marshal

public static javax.jms.MapMessage marshal(java.lang.Object bean,
                                           javax.jms.Session session)
                                    throws ConverterException
Marshal a bean into a JMS message.

Parameters:
bean - Bean.
session - JMS session - this is required to create the JMS message.
Returns:
Marshalled bean.
Throws:
ConverterException

unmarshal

public static java.lang.Object unmarshal(javax.jms.MapMessage source)
                                  throws ConverterException
Unmarshal a bean from a JMS message.

Parameters:
source - JMS message.
Returns:
New bean instance.
Throws:
ConverterException

unmarshal

public static java.lang.Object unmarshal(javax.jms.MapMessage source,
                                         java.lang.String beanName,
                                         java.lang.String fullName)
                                  throws ConverterException
Unmarshal a bean from a JMS message.

Parameters:
source - JMS message.
beanName - Short name of bean.
fullName - Full name of bean (includes the package).
Returns:
New bean instance.
Throws:
ConverterException


Copyright © 2003-2006 CodeStreet. All Rights Reserved.