org.objectweb.telosys.rpl.xml
Class XmlWrapperAncestor

java.lang.Object
  extended byorg.objectweb.telosys.rpl.xml.XmlWrapperAncestor
Direct Known Subclasses:
BigDecimalValueMapper, BooleanValueMapper, DateValueMapper, DoubleValueMapper, FloatValueMapper, IntValueMapper, LongValueMapper, StringValueMapper

public abstract class XmlWrapperAncestor
extends java.lang.Object

Generic XML Wrapper ancestor


Field Summary
static int DATE_AND_TIME
           
static int DATE_ONLY
           
static int TIME_ONLY
           
 
Constructor Summary
protected XmlWrapperAncestor(java.lang.Class beanClass)
          Constructor
 
Method Summary
protected  java.lang.String attributeString(java.math.BigDecimal v)
          Returns the XML attribute string for the given BigDecimal instance
protected  java.lang.String attributeString(boolean bValue)
          Returns the XML attribute string for the given boolean value
protected  java.lang.String attributeString(java.lang.Boolean v)
          Returns the XML attribute string for the given Boolean instance
protected  java.lang.String attributeString(java.lang.Byte v)
          Returns the XML attribute string for the given Byte instance
protected  java.lang.String attributeString(java.util.Date date)
          Returns the XML attribute string for the given date value
protected  java.lang.String attributeString(java.util.Date date, int iType)
          Returns the XML attribute string for the given date value
protected  java.lang.String attributeString(java.lang.Double v)
          Returns the XML attribute string for the given Double instance
protected  java.lang.String attributeString(java.lang.Float v)
          Returns the XML attribute string for the given Float instance
protected  java.lang.String attributeString(java.lang.Integer v)
          Returns the XML attribute string for the given Integer instance
protected  java.lang.String attributeString(java.lang.Long v)
          Returns the XML attribute string for the given Long instance
protected  java.lang.String attributeString(java.lang.Short v)
          Returns the XML attribute string for the given Short instance
protected  java.lang.String attributeString(java.lang.String sValue)
          Returns the XML attribute string (with XML entities) for the given string value
protected  void generateTextTag(java.io.PrintWriter out, java.lang.String sTagName, java.lang.String sTagContent)
          Generates a "long text" tag for the given tag content.
 java.lang.Class getBeanClass()
           
 java.lang.String getBeanClassName()
           
protected  java.math.BigDecimal getBigDecimal(java.lang.String sFieldName, java.lang.String sValue)
          Returns a BigDecimal instance built from the given string value
protected  boolean getBoolean(java.lang.String sFieldName, java.lang.String sValue)
          Return a boolean from the given string attribute value
protected  java.lang.Boolean getBooleanObject(java.lang.String sFieldName, java.lang.String sValue)
          Returns a Boolean instance built from the given string value
protected  byte getByte(java.lang.String sFieldName, java.lang.String sValue)
          Returns a byte value from the given string attribute value
protected  byte getByte(java.lang.String sFieldName, java.lang.String sValue, short defaultValue)
          Returns a byte value from the given string attribute value
protected  java.lang.Byte getByteObject(java.lang.String sFieldName, java.lang.String sValue)
          Returns a Byte instance built from the given string value
protected  java.util.Date getDateISO(java.lang.String sFieldName, java.lang.String sDate)
          Returns a date instance from the given date in ISO format "YYYY-MM-DD"
protected  java.util.Date getDateTimeISO(java.lang.String sFieldName, java.lang.String sDate)
          Returns a date instance from the given date-time in ISO format "YYYY-MM-DD HH:MM:SS"
protected  double getDouble(java.lang.String sFieldName, java.lang.String sValue)
          Returns a double from the given string attribute value
protected  double getDouble(java.lang.String sFieldName, java.lang.String sValue, double defaultValue)
          Returns a double from the given string attribute value
protected  java.lang.Double getDoubleObject(java.lang.String sFieldName, java.lang.String sValue)
          Returns a Double instance built from the given string value
protected  float getFloat(java.lang.String sFieldName, java.lang.String sValue)
          Returns a float from the given string attribute value
protected  float getFloat(java.lang.String sFieldName, java.lang.String sValue, float defaultValue)
          Returns a float from the given string attribute value
protected  java.lang.Float getFloatObject(java.lang.String sFieldName, java.lang.String sValue)
          Returns a Float instance built from the given string value
protected  int getInt(java.lang.String sFieldName, java.lang.String sValue)
          Returns an integer from the given string attribute value
protected  int getInt(java.lang.String sFieldName, java.lang.String sValue, int iDefaultValue)
          Returns an integer from the given string attribute value
protected  java.lang.Integer getIntObject(java.lang.String sFieldName, java.lang.String sValue)
          Returns an Integer instance built from the given string value
protected  long getLong(java.lang.String sFieldName, java.lang.String sValue)
          Returns a long value from the given string attribute value
protected  long getLong(java.lang.String sFieldName, java.lang.String sValue, long lDefaultValue)
          Returns a long value from the given string attribute value
protected  java.lang.Long getLongObject(java.lang.String sFieldName, java.lang.String sValue)
          Returns a Long instance built from the given string value
protected  short getShort(java.lang.String sFieldName, java.lang.String sValue)
          Returns a short value from the given string attribute value
protected  short getShort(java.lang.String sFieldName, java.lang.String sValue, short defaultValue)
          Returns a short value from the given string attribute value
protected  java.lang.Short getShortObject(java.lang.String sFieldName, java.lang.String sValue)
          Returns a Short instance built from the given string value
protected  java.util.Date getTimeISO(java.lang.String sFieldName, java.lang.String sValue)
          Returns a date instance containing the time from the given date in ISO format "HH:mm:ss"
protected  void throwException(java.lang.String sMessage)
          Throws a TelosysRuntimeException with the given message
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DATE_ONLY

public static final int DATE_ONLY
See Also:
Constant Field Values

TIME_ONLY

public static final int TIME_ONLY
See Also:
Constant Field Values

DATE_AND_TIME

public static final int DATE_AND_TIME
See Also:
Constant Field Values
Constructor Detail

XmlWrapperAncestor

protected XmlWrapperAncestor(java.lang.Class beanClass)
Constructor

Method Detail

toString

public java.lang.String toString()

getBeanClass

public final java.lang.Class getBeanClass()

getBeanClassName

public final java.lang.String getBeanClassName()

throwException

protected final void throwException(java.lang.String sMessage)
Throws a TelosysRuntimeException with the given message

Parameters:
sMessage - the error message

getBoolean

protected boolean getBoolean(java.lang.String sFieldName,
                             java.lang.String sValue)
Return a boolean from the given string attribute value

Parameters:
sFieldName - : the name of the field
sValue - : the attribute value
Returns:
boolean : true or false
Throws:
TelosysRuntimeException - if the given value is not valid

getLong

protected long getLong(java.lang.String sFieldName,
                       java.lang.String sValue)
Returns a long value from the given string attribute value

Parameters:
sFieldName - : the name of the field
sValue - : the value to convert ( cannot be null or void )
Returns:
the long value
Throws:
TelosysRuntimeException - if the given value is null, void or invalid

getLong

protected long getLong(java.lang.String sFieldName,
                       java.lang.String sValue,
                       long lDefaultValue)
Returns a long value from the given string attribute value

Parameters:
sFieldName - : the name of the field
sValue - : the value to convert ( can be null or void )
lDefaultValue - : the default value to use if the string is null or void
Returns:
the long value
Throws:
TelosysRuntimeException - if the given value is invalid

getInt

protected int getInt(java.lang.String sFieldName,
                     java.lang.String sValue)
Returns an integer from the given string attribute value

Parameters:
sFieldName - : the name of the field
sValue - : the value to convert ( cannot be null or void )
Returns:
the integer value
Throws:
TelosysRuntimeException - if the given value is null, void or invalid

getInt

protected int getInt(java.lang.String sFieldName,
                     java.lang.String sValue,
                     int iDefaultValue)
Returns an integer from the given string attribute value

Parameters:
sFieldName - : the name of the field
sValue - : the value to convert ( can be null or void )
iDefaultValue - : the default value to use if the string is null or void
Returns:
the integer value
Throws:
TelosysRuntimeException - if the given value is invalid

getShort

protected short getShort(java.lang.String sFieldName,
                         java.lang.String sValue)
Returns a short value from the given string attribute value

Parameters:
sFieldName - : the name of the field
sValue - : the value to convert ( cannot be null or void )
Returns:
the short value
Throws:
TelosysRuntimeException - if the given value is null, void or invalid

getShort

protected short getShort(java.lang.String sFieldName,
                         java.lang.String sValue,
                         short defaultValue)
Returns a short value from the given string attribute value

Parameters:
sFieldName - : the name of the field
sValue - : the value to convert ( can be null or void )
defaultValue - : the default value to use if the string is null or void
Returns:
the short value
Throws:
TelosysRuntimeException - if the given value is invalid

getByte

protected byte getByte(java.lang.String sFieldName,
                       java.lang.String sValue)
Returns a byte value from the given string attribute value

Parameters:
sFieldName - : the name of the field
sValue - : the value to convert ( cannot be null or void )
Returns:
the byte value
Throws:
TelosysRuntimeException - if the given value is null, void or invalid

getByte

protected byte getByte(java.lang.String sFieldName,
                       java.lang.String sValue,
                       short defaultValue)
Returns a byte value from the given string attribute value

Parameters:
sFieldName - : the name of the field
sValue - : the value to convert ( can be null or void )
defaultValue - : the default value to use if the string is null or void
Returns:
the byte value
Throws:
TelosysRuntimeException - if the given value is invalid

getDouble

protected double getDouble(java.lang.String sFieldName,
                           java.lang.String sValue)
Returns a double from the given string attribute value

Parameters:
sFieldName - : the name of the field
sValue - : the value to convert ( cannot be null or void )
Returns:
the double value
Throws:
TelosysRuntimeException - if the given value is null, void or invalid

getDouble

protected double getDouble(java.lang.String sFieldName,
                           java.lang.String sValue,
                           double defaultValue)
Returns a double from the given string attribute value

Parameters:
sFieldName - : the name of the field
sValue - : the value to convert ( can be null or void )
defaultValue - : the default value to use if the string is null or void
Returns:
the double value
Throws:
TelosysRuntimeException - if the given value is not valid

getFloat

protected float getFloat(java.lang.String sFieldName,
                         java.lang.String sValue)
Returns a float from the given string attribute value

Parameters:
sFieldName - : the name of the field
sValue - : the value to convert ( cannot be null or void )
Returns:
the float value
Throws:
TelosysRuntimeException - if the given value is null, void or invalid

getFloat

protected float getFloat(java.lang.String sFieldName,
                         java.lang.String sValue,
                         float defaultValue)
Returns a float from the given string attribute value

Parameters:
sFieldName - : the name of the field
sValue - : the value to convert ( can be null or void )
defaultValue - : the default value to use if the string is null or void
Returns:
the float value
Throws:
TelosysRuntimeException - if the given value is not valid

getDateISO

protected java.util.Date getDateISO(java.lang.String sFieldName,
                                    java.lang.String sDate)
Returns a date instance from the given date in ISO format "YYYY-MM-DD"

Parameters:
sFieldName - : the name of the field
sDate - the attribute date value in ISO format ( "YYYY-MM-DD" )
Returns:
java.sql.Date : the date instance ( or null is the input date is void )
Throws:
TelosysRuntimeException - if the given date is not valid

getTimeISO

protected java.util.Date getTimeISO(java.lang.String sFieldName,
                                    java.lang.String sValue)
Returns a date instance containing the time from the given date in ISO format "HH:mm:ss"

Parameters:
sFieldName - : the name of the field
sValue - the attribute time value in ISO format ( "HH:mm:ss" )
Returns:
java.sql.Date : the date instance ( or null is the input date is void )
Throws:
TelosysRuntimeException - if the given date is not valid

getDateTimeISO

protected java.util.Date getDateTimeISO(java.lang.String sFieldName,
                                        java.lang.String sDate)
Returns a date instance from the given date-time in ISO format "YYYY-MM-DD HH:MM:SS"

Parameters:
sFieldName - : the name of the field
sDate - the attribute date-time value in ISO format ( "YYYY-MM-DD HH:MM:SS" )
Returns:
java.sql.Date : the date instance ( or null is the input date is void )
Throws:
TelosysRuntimeException - if the given date is not valid

getBooleanObject

protected java.lang.Boolean getBooleanObject(java.lang.String sFieldName,
                                             java.lang.String sValue)
Returns a Boolean instance built from the given string value

Parameters:
sFieldName -
sValue -
Returns:
the object or null if the value is null or void

getByteObject

protected java.lang.Byte getByteObject(java.lang.String sFieldName,
                                       java.lang.String sValue)
Returns a Byte instance built from the given string value

Parameters:
sFieldName -
sValue -
Returns:
the object or null if the value is null or void

getShortObject

protected java.lang.Short getShortObject(java.lang.String sFieldName,
                                         java.lang.String sValue)
Returns a Short instance built from the given string value

Parameters:
sFieldName -
sValue -
Returns:
the object or null if the value is null or void

getIntObject

protected java.lang.Integer getIntObject(java.lang.String sFieldName,
                                         java.lang.String sValue)
Returns an Integer instance built from the given string value

Parameters:
sFieldName -
sValue -
Returns:
the object or null if the value is null or void

getLongObject

protected java.lang.Long getLongObject(java.lang.String sFieldName,
                                       java.lang.String sValue)
Returns a Long instance built from the given string value

Parameters:
sFieldName -
sValue -
Returns:
the object or null if the value is null or void

getFloatObject

protected java.lang.Float getFloatObject(java.lang.String sFieldName,
                                         java.lang.String sValue)
Returns a Float instance built from the given string value

Parameters:
sFieldName -
sValue -
Returns:
the object or null if the value is null or void

getDoubleObject

protected java.lang.Double getDoubleObject(java.lang.String sFieldName,
                                           java.lang.String sValue)
Returns a Double instance built from the given string value

Parameters:
sFieldName -
sValue -
Returns:
the object or null if the value is null or void

getBigDecimal

protected java.math.BigDecimal getBigDecimal(java.lang.String sFieldName,
                                             java.lang.String sValue)
Returns a BigDecimal instance built from the given string value

Parameters:
sFieldName -
sValue -
Returns:
the object or null if the value is null or void

attributeString

protected java.lang.String attributeString(java.lang.String sValue)
Returns the XML attribute string (with XML entities) for the given string value

Parameters:
sValue -
Returns:

attributeString

protected java.lang.String attributeString(java.util.Date date)
Returns the XML attribute string for the given date value

Parameters:
date -
Returns:
the date in ISO format ( YYYY-MM-DD ) or "" if date is null

attributeString

protected java.lang.String attributeString(java.util.Date date,
                                           int iType)
Returns the XML attribute string for the given date value

Parameters:
date -
iType - : DATE_ONLY ( YYYY-MM-DD ), TIME_ONLY ( HH:MM:SS ) or DATE_AND_TIME ( YYYY-MM-DD HH:MM:SS )
Returns:

attributeString

protected java.lang.String attributeString(boolean bValue)
Returns the XML attribute string for the given boolean value

Parameters:
bValue -
Returns:
"1" for true, "0" for false

attributeString

protected java.lang.String attributeString(java.lang.Boolean v)
Returns the XML attribute string for the given Boolean instance

Parameters:
v -
Returns:
boolean value ( "1" for true, "0" for false ) or "" if null

attributeString

protected java.lang.String attributeString(java.lang.Byte v)
Returns the XML attribute string for the given Byte instance

Parameters:
v -
Returns:
value or "" if null

attributeString

protected java.lang.String attributeString(java.lang.Short v)
Returns the XML attribute string for the given Short instance

Parameters:
v -
Returns:
value or "" if null

attributeString

protected java.lang.String attributeString(java.lang.Integer v)
Returns the XML attribute string for the given Integer instance

Parameters:
v -
Returns:
value or "" if null

attributeString

protected java.lang.String attributeString(java.lang.Long v)
Returns the XML attribute string for the given Long instance

Parameters:
v -
Returns:
value or "" if null

attributeString

protected java.lang.String attributeString(java.lang.Float v)
Returns the XML attribute string for the given Float instance

Parameters:
v -
Returns:
value or "" if null

attributeString

protected java.lang.String attributeString(java.lang.Double v)
Returns the XML attribute string for the given Double instance

Parameters:
v -
Returns:
value or "" if null

attributeString

protected java.lang.String attributeString(java.math.BigDecimal v)
Returns the XML attribute string for the given BigDecimal instance

Parameters:
v -
Returns:
value or "" if null

generateTextTag

protected void generateTextTag(java.io.PrintWriter out,
                               java.lang.String sTagName,
                               java.lang.String sTagContent)
Generates a "long text" tag for the given tag content.
Output : <tagname> <![CDATA[...tag...content...]]> </tagname>

Parameters:
out -
sTagName -
sTagContent -