goldengate.common.xml
Class XmlValue

java.lang.Object
  extended by goldengate.common.xml.XmlValue

public class XmlValue
extends Object

XmlValue base element

Author:
Frederic Bregier

Constructor Summary
XmlValue(XmlDecl decl)
           
XmlValue(XmlValue from)
           
 
Method Summary
 void addFromString(String value)
          Add a value into the Multiple values from the String (not compatible with subXml)
 void addValue(Object value)
          Add a value into the Multiple values from the Object
protected static Object convert(Class<?> type, String value)
          Convert String value to the specified type.
 boolean getBoolean()
           
 byte getByte()
           
 char getCharacter()
           
 Class<?> getClassType()
           
 Object getCloneValue()
           
static Object getCloneValue(XmlType type, Object value)
          Utility function to get a clone of a value
 Date getDate()
           
 XmlDecl getDecl()
           
 double getDouble()
           
 float getFloat()
           
 int getInteger()
           
 String getIntoString()
          Get a value into a String
 List<?> getList()
           
 long getLong()
           
 String getName()
          Get Java field name
 short getShort()
           
 String getString()
           
 XmlValue[] getSubXml()
           
 Timestamp getTimestamp()
           
 XmlType getType()
           
 Object getValue()
           
 String getXmlPath()
           
 boolean isEmpty()
          Test if the Value is empty.
 boolean isMultiple()
           
 boolean isSubXml()
           
 void setFromString(String value)
          Set a value from String
 void setValue(Object value)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XmlValue

public XmlValue(XmlDecl decl)

XmlValue

public XmlValue(XmlValue from)
Method Detail

getDecl

public XmlDecl getDecl()
Returns:
the decl

getName

public String getName()
Get Java field name

Returns:
the field name

getClassType

public Class<?> getClassType()
Returns:
the type

getType

public XmlType getType()
Returns:
the type

getXmlPath

public String getXmlPath()
Returns:
the xmlPath

isSubXml

public boolean isSubXml()
Returns:
True if this Value is a subXml

getSubXml

public XmlValue[] getSubXml()
Returns:
the associated SubXML with the XmlValue (might be null if singleton or Multiple)

isMultiple

public boolean isMultiple()
Returns:
True if the Value are list of values

getList

public List<?> getList()
Returns:
the associated list with the XmlValues (might be null if singleton or SubXml)

addFromString

public void addFromString(String value)
                   throws InvalidObjectException
Add a value into the Multiple values from the String (not compatible with subXml)

Parameters:
value -
Throws:
InvalidObjectException

addValue

public void addValue(Object value)
              throws InvalidObjectException
Add a value into the Multiple values from the Object

Parameters:
value -
Throws:
InvalidObjectException

getValue

public Object getValue()
Returns:
the value as Object (might be null if multiple)

getCloneValue

public static Object getCloneValue(XmlType type,
                                   Object value)
                            throws InvalidObjectException
Utility function to get a clone of a value

Parameters:
type -
value -
Returns:
the clone Object
Throws:
InvalidObjectException

getCloneValue

public Object getCloneValue()
                     throws InvalidObjectException
Returns:
a clone of the value as Object (might be null if multiple)
Throws:
InvalidObjectException

getString

public String getString()
Returns:
the value as a string

getInteger

public int getInteger()
Returns:
the value as an integer

getBoolean

public boolean getBoolean()
Returns:
the value as a boolean

getLong

public long getLong()
Returns:
the value as a long

getFloat

public float getFloat()
Returns:
the value as a float

getCharacter

public char getCharacter()
Returns:
the value as a float

getByte

public byte getByte()
Returns:
the value as a float

getDouble

public double getDouble()
Returns:
the value as a float

getShort

public short getShort()
Returns:
the value as a float

getDate

public Date getDate()
Returns:
the value as a float

getTimestamp

public Timestamp getTimestamp()
Returns:
the value as a float

setFromString

public void setFromString(String value)
Set a value from String

Parameters:
value -

isEmpty

public boolean isEmpty()
Test if the Value is empty. If it is a SubXml or isMultiple, check if subnodes are present but not if those nodes are empty.

Returns:
True if the Value is Empty

getIntoString

public String getIntoString()
Get a value into a String

Returns:
the value in String format

setValue

public void setValue(Object value)
              throws InvalidObjectException
Parameters:
value - the value to set
Throws:
InvalidObjectException
NumberFormatException

convert

protected static Object convert(Class<?> type,
                                String value)
                         throws IllegalArgumentException
Convert String value to the specified type. Throws IllegalArgumentException if type is unrecognized.

Throws:
IllegalArgumentException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009-2012 Frederic Bregier. All Rights Reserved.