com.codestreet.messageforge
Class Converter

java.lang.Object
  extended bycom.codestreet.messageforge.Converter
Direct Known Subclasses:
ConverterBeanAndJMS, ConverterBeanAndTibrv, ConverterJMS, ConverterSerialization, ConverterTibrv, ConverterXML

public abstract class Converter
extends java.lang.Object

Base class for all converters.

Author:
Jawaid Hakim.

Constructor Summary
Converter()
           
 
Method Summary
static RMapMessage createMsgObject(java.lang.Class cls)
           
static RMapMessage createMsgObject(java.lang.String msgName)
           
protected static java.lang.Double dateToDouble(RFldDatetime dateTime)
          Marshall a RFldDatetime field object as a Double.
protected static java.lang.Long dateToLong(RFldDatetime dateTime)
          Marshall a RFldDatetime field object as a Long.
protected static java.lang.String dateToStr(RFldDatetime dateTime)
          Marshall a RFldDatetime field object as a string.
static RBeanValidator getBeanValidator()
          Get the bean validator instance.
static boolean getLenient()
          Get the lenient setting for the date formatter.
static java.lang.String getVersion()
          Get the version of the library.
static void setBeanValidator(RBeanValidator beanValidator)
          Set bean validator instance.
protected static void setDateFromDouble(RFldDatetime dateTime, java.lang.Double dblDate)
          Ummarshall a RFldDatetime field object from a Double.
protected static void setDateFromLong(RFldDatetime dateTime, java.lang.Long longDate)
          Ummarshall a RFldDatetime field object from a Long.
protected static void setDateFromStr(RFldDatetime dateTime, java.lang.String strDate)
          Ummarshall a RFldDatetime field object from a string.
static void setDefaultFactory(RMsgFactory[] factories)
          Set default message factory.
static void setMaximumFractionDigits(int maximumFractionDigits)
          Sets the maximum number of digits allowed in the fraction portion of a BigDecimal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Converter

public Converter()
Method Detail

getVersion

public static java.lang.String getVersion()
Get the version of the library.

Returns:
Converter version.

createMsgObject

public static RMapMessage createMsgObject(java.lang.String msgName)
                                   throws ConverterException
Throws:
ConverterException

createMsgObject

public static RMapMessage createMsgObject(java.lang.Class cls)
                                   throws ConverterException
Throws:
ConverterException

setDefaultFactory

public static void setDefaultFactory(RMsgFactory[] factories)
                              throws ConverterException
Set default message factory. More than one message factory may be installed. If more than one factory is then installed then each factory is used - one at a time - until teh desired message can be instantiated.

Parameters:
factories - Default message factories.
Throws:
ConverterException

setMaximumFractionDigits

public static void setMaximumFractionDigits(int maximumFractionDigits)
Sets the maximum number of digits allowed in the fraction portion of a BigDecimal. Default is 8. If less than 0 then 0 is used.

Parameters:
maximumFractionDigits - maximum number of digits allowed in the fraction portion of a BigDecimal

setBeanValidator

public static void setBeanValidator(RBeanValidator beanValidator)
Set bean validator instance.

Parameters:
beanValidator - Bean validator instance. This instance will be called to validate beans.

getBeanValidator

public static RBeanValidator getBeanValidator()
Get the bean validator instance.

Returns:
Bean validator instance.

dateToStr

protected static java.lang.String dateToStr(RFldDatetime dateTime)
Marshall a RFldDatetime field object as a string.

Parameters:
dateTime - Datetime field object.
Returns:
Message object as a string.
See Also:
setDateFromStr(RFldDatetime, String)

setDateFromStr

protected static void setDateFromStr(RFldDatetime dateTime,
                                     java.lang.String strDate)
                              throws FieldValidationException
Ummarshall a RFldDatetime field object from a string. The string is parsed and the value of the message object is set.

Parameters:
dateTime - Datetime field object.
strDate - Date. It should have been formatted using dateToStr().
Throws:
FieldValidationException
See Also:
dateToStr(RFldDatetime)

dateToLong

protected static java.lang.Long dateToLong(RFldDatetime dateTime)
Marshall a RFldDatetime field object as a Long.

Parameters:
dateTime - Datetime field object.
Returns:
Message object as a Long.
See Also:
setDateFromLong(RFldDatetime, Long)

setDateFromLong

protected static void setDateFromLong(RFldDatetime dateTime,
                                      java.lang.Long longDate)
                               throws FieldValidationException
Ummarshall a RFldDatetime field object from a Long.

Parameters:
dateTime - Datetime field object.
longDate - Date.
Throws:
FieldValidationException
See Also:
dateToLong(RFldDatetime)

dateToDouble

protected static java.lang.Double dateToDouble(RFldDatetime dateTime)
Marshall a RFldDatetime field object as a Double.

Parameters:
dateTime - Datetime field object.
Returns:
Message object as a Double.
See Also:
setDateFromLong(RFldDatetime, Long)

setDateFromDouble

protected static void setDateFromDouble(RFldDatetime dateTime,
                                        java.lang.Double dblDate)
                                 throws FieldValidationException
Ummarshall a RFldDatetime field object from a Double.

Parameters:
dateTime - Datetime field object.
dblDate - Date.
Throws:
FieldValidationException
See Also:
dateToLong(RFldDatetime)

getLenient

public static boolean getLenient()
Get the lenient setting for the date formatter. Default locale is true.

Returns:
Lenient setting.


Copyright © 2003-2006 CodeStreet. All Rights Reserved.