org.ocd.blx
Class XMLProperties

java.lang.Object
  |
  +--org.ocd.blx.XMLProperties

public class XMLProperties
extends java.lang.Object

This class wraps a java.util.Map and enables Map contents to be retrieved and Converted to XML

This Class can only except Integers, String, Longs, Floats, Doubles, Dates, and Booleans

Version:
 
Author:
ocd_dino

Field Summary
static java.lang.String BEAN_CLASS_ATTR_NAME
           
static java.lang.String BOOLEAN_ATTR_TYPE
           
static int BOOLEAN_TYPE
           
static java.lang.String DATE_ATTR_TYPE
           
static int DATE_TYPE
           
static java.lang.String DOUBLE_ATTR_TYPE
           
static int DOUBLE_TYPE
           
static java.lang.String FLOAT_ATTR_TYPE
           
static int FLOAT_TYPE
           
static java.lang.String INT_ATTR_TYPE
           
static int INT_TYPE
           
static java.lang.String LONG_ATTR_TYPE
           
static int LONG_TYPE
           
static java.lang.String NAME_ATTR_NAME
           
static java.lang.String NULL_ATTR_TYPE
           
static int NULL_TYPE
           
static java.lang.String PROPERTIES_NODE_NAME
           
static java.lang.String PROPERTY_NODE_NAME
           
static java.lang.String STRING_ATTR_TYPE
           
static int STRING_TYPE
           
static java.lang.String TYPE_ATTR_NAME
           
static java.lang.String VALUE_ATTR_NAME
           
 
Constructor Summary
XMLProperties()
          Create a new Properties Object
XMLProperties(java.lang.Object pBean, java.lang.String[] propNames)
          Create a new Properties Object.
 
Method Summary
 java.lang.Object getBean()
          Get the Bean this Property Object is listening on.
 java.lang.Object getProperty(java.lang.String pName)
          Get Property
 boolean getPropertyBoolean(java.lang.String pName)
          Get Property as boolean
 java.util.Date getPropertyDate(java.lang.String pName)
          Get Property as Date
 double getPropertyDouble(java.lang.String pName)
          Get Property as double
 float getPropertyFloat(java.lang.String pName)
          Get Property as float
 int getPropertyInt(java.lang.String pName)
          get Property as int
 long getPropertyLong(java.lang.String pName)
          Get Property as long
 java.lang.String getPropertyString(java.lang.String pName)
          Get Property as String
 int getPropertyType(java.lang.String pName)
          Get the Type of the Property
 org.w3c.dom.Element getXMLElement()
          Get the Data Node for this Component
 void setBean(java.lang.Object pBean, java.lang.String[] pPropNames)
          Set the Bean this Property Object is listening on.
 void setProperty(java.lang.String pName, java.lang.Object pValue)
          Set Property
 void setPropertyBoolean(java.lang.String pName, boolean pValue)
          Set Boolean Property
 void setPropertyDate(java.lang.String pName, java.util.Date pValue)
          Set Date Property
 void setPropertyDouble(java.lang.String pName, double pValue)
          Set double Property
 void setPropertyFloat(java.lang.String pName, float pValue)
          Set float Property
 void setPropertyInt(java.lang.String pName, int pValue)
          Set int Property
 void setPropertyLong(java.lang.String pName, long pValue)
          Set long Property
 void setPropertyString(java.lang.String pName, java.lang.String pValue)
          Set String Property
 void setXMLElement(org.w3c.dom.Element pElement)
          Set the Node on this Component
 boolean xmlHasChanged()
          Return true if this components state has changed in a way that Requires a new XML Node to be fetched
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRING_TYPE

public static final int STRING_TYPE

INT_TYPE

public static final int INT_TYPE

LONG_TYPE

public static final int LONG_TYPE

FLOAT_TYPE

public static final int FLOAT_TYPE

DOUBLE_TYPE

public static final int DOUBLE_TYPE

DATE_TYPE

public static final int DATE_TYPE

BOOLEAN_TYPE

public static final int BOOLEAN_TYPE

NULL_TYPE

public static final int NULL_TYPE

STRING_ATTR_TYPE

public static final java.lang.String STRING_ATTR_TYPE

INT_ATTR_TYPE

public static final java.lang.String INT_ATTR_TYPE

LONG_ATTR_TYPE

public static final java.lang.String LONG_ATTR_TYPE

FLOAT_ATTR_TYPE

public static final java.lang.String FLOAT_ATTR_TYPE

DOUBLE_ATTR_TYPE

public static final java.lang.String DOUBLE_ATTR_TYPE

DATE_ATTR_TYPE

public static final java.lang.String DATE_ATTR_TYPE

BOOLEAN_ATTR_TYPE

public static final java.lang.String BOOLEAN_ATTR_TYPE

NULL_ATTR_TYPE

public static final java.lang.String NULL_ATTR_TYPE

PROPERTIES_NODE_NAME

public static final java.lang.String PROPERTIES_NODE_NAME

BEAN_CLASS_ATTR_NAME

public static final java.lang.String BEAN_CLASS_ATTR_NAME

PROPERTY_NODE_NAME

public static final java.lang.String PROPERTY_NODE_NAME

TYPE_ATTR_NAME

public static final java.lang.String TYPE_ATTR_NAME

NAME_ATTR_NAME

public static final java.lang.String NAME_ATTR_NAME

VALUE_ATTR_NAME

public static final java.lang.String VALUE_ATTR_NAME
Constructor Detail

XMLProperties

public XMLProperties()
Create a new Properties Object

XMLProperties

public XMLProperties(java.lang.Object pBean,
                     java.lang.String[] propNames)
Create a new Properties Object. That uses a Bean to get and set the Properties. This allows this XML Properties object to store Bean Properties
Parameters:
pBean - to store properties for
propNames - names of Properties to store for this Bean
Method Detail

getPropertyType

public int getPropertyType(java.lang.String pName)
Get the Type of the Property
Parameters:
pName - Name of Property
Returns:
type of Property

getPropertyString

public java.lang.String getPropertyString(java.lang.String pName)
Get Property as String
Parameters:
-  

getPropertyInt

public int getPropertyInt(java.lang.String pName)
get Property as int

getPropertyLong

public long getPropertyLong(java.lang.String pName)
Get Property as long

getPropertyFloat

public float getPropertyFloat(java.lang.String pName)
Get Property as float

getPropertyDouble

public double getPropertyDouble(java.lang.String pName)
Get Property as double

getPropertyDate

public java.util.Date getPropertyDate(java.lang.String pName)
Get Property as Date

getPropertyBoolean

public boolean getPropertyBoolean(java.lang.String pName)
Get Property as boolean

getProperty

public java.lang.Object getProperty(java.lang.String pName)
Get Property

setProperty

public void setProperty(java.lang.String pName,
                        java.lang.Object pValue)
Set Property

setPropertyInt

public void setPropertyInt(java.lang.String pName,
                           int pValue)
Set int Property

setPropertyLong

public void setPropertyLong(java.lang.String pName,
                            long pValue)
Set long Property

setPropertyFloat

public void setPropertyFloat(java.lang.String pName,
                             float pValue)
Set float Property

setPropertyDouble

public void setPropertyDouble(java.lang.String pName,
                              double pValue)
Set double Property

setPropertyDate

public void setPropertyDate(java.lang.String pName,
                            java.util.Date pValue)
Set Date Property

setPropertyBoolean

public void setPropertyBoolean(java.lang.String pName,
                               boolean pValue)
Set Boolean Property

setPropertyString

public void setPropertyString(java.lang.String pName,
                              java.lang.String pValue)
Set String Property

xmlHasChanged

public boolean xmlHasChanged()
Return true if this components state has changed in a way that Requires a new XML Node to be fetched
Returns:
true if component has changed

setXMLElement

public void setXMLElement(org.w3c.dom.Element pElement)
Set the Node on this Component
Parameters:
Node - that contains this components settings

setBean

public void setBean(java.lang.Object pBean,
                    java.lang.String[] pPropNames)
Set the Bean this Property Object is listening on. If the Bean supports Bound Properties then this Object will listen for property Changes on the bean and store the property values.
Parameters:
pBean - to listen for property changes or null to not listen for property changes on a Bean
pPropNames - names of Properties we should listen on or null for all properties

getBean

public java.lang.Object getBean()
Get the Bean this Property Object is listening on.
Returns:
the Bean

getXMLElement

public org.w3c.dom.Element getXMLElement()
Get the Data Node for this Component
Returns:
the Node that contains this Components Settings