edu.nrao.sss.util
Class XmlWrapper

java.lang.Object
  extended by edu.nrao.sss.util.XmlWrapper
All Implemented Interfaces:
InvocationHandler

public class XmlWrapper
extends Object
implements InvocationHandler

This is a base class for simple Java POJOs that reflect an XML file.


Nested Class Summary
protected static class XmlWrapper.Tuple
           
 
Field Summary
static SimpleDateFormat ISO_8601
           
static SimpleDateFormat ISO_8601_s
           
 
Constructor Summary
XmlWrapper()
           
XmlWrapper(InputSource source)
           
XmlWrapper(InputSource source, String root)
           
XmlWrapper(InputSource source, String root, String[][] stringArray)
           
XmlWrapper(String uri)
           
XmlWrapper(String uri, String root)
           
XmlWrapper(String uri, String root, String[][] stringArray)
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
           
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
           
 void commit()
           
protected  void fillParameters(String[][] stringArray)
           
 List<String> get(String parameter)
           
protected  boolean getBool(String key)
          If the key points to a Tuple with multiple values in its list, this uses the first one.
protected  Date getDate(String key)
          If the key points to a Tuple with multiple values in its list, this uses the first one.
static
<T> T
getInstanceOf(Class<T> interFace, InputSource is, String root, String[][] stringArray)
           
static
<T> T
getInstanceOf(Class<T> interFace, String uri, String root, String[][] stringArray)
           
 Object invoke(Object proxy, Method method, Object[] args)
           
 void set(String parameter, List<String> list)
           
protected  void setBool(String key, boolean value)
           
protected  void setDate(String key, Date value)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ISO_8601

public static final SimpleDateFormat ISO_8601

ISO_8601_s

public static final SimpleDateFormat ISO_8601_s
Constructor Detail

XmlWrapper

public XmlWrapper(String uri)
           throws SAXException,
                  IOException,
                  ParserConfigurationException
Throws:
SAXException
IOException
ParserConfigurationException

XmlWrapper

public XmlWrapper(String uri,
                  String root)
           throws SAXException,
                  IOException,
                  ParserConfigurationException,
                  XPathExpressionException
Throws:
SAXException
IOException
ParserConfigurationException
XPathExpressionException

XmlWrapper

public XmlWrapper(String uri,
                  String root,
                  String[][] stringArray)
           throws SAXException,
                  IOException,
                  ParserConfigurationException,
                  XPathExpressionException
Throws:
SAXException
IOException
ParserConfigurationException
XPathExpressionException

XmlWrapper

public XmlWrapper()

XmlWrapper

public XmlWrapper(InputSource source)
           throws SAXException,
                  IOException,
                  ParserConfigurationException
Throws:
SAXException
IOException
ParserConfigurationException

XmlWrapper

public XmlWrapper(InputSource source,
                  String root)
           throws SAXException,
                  IOException,
                  ParserConfigurationException,
                  XPathExpressionException
Throws:
SAXException
IOException
ParserConfigurationException
XPathExpressionException

XmlWrapper

public XmlWrapper(InputSource source,
                  String root,
                  String[][] stringArray)
           throws SAXException,
                  IOException,
                  ParserConfigurationException,
                  XPathExpressionException
Throws:
SAXException
IOException
ParserConfigurationException
XPathExpressionException
Method Detail

get

public List<String> get(String parameter)

set

public void set(String parameter,
                List<String> list)

commit

public void commit()
            throws XPathExpressionException
Throws:
XPathExpressionException

fillParameters

protected void fillParameters(String[][] stringArray)
                       throws XPathExpressionException
Throws:
XPathExpressionException

toString

public String toString()
Overrides:
toString in class Object

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Specified by:
invoke in interface InvocationHandler
Throws:
Throwable

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)

getDate

protected Date getDate(String key)
If the key points to a Tuple with multiple values in its list, this uses the first one.


setDate

protected void setDate(String key,
                       Date value)

getBool

protected boolean getBool(String key)
If the key points to a Tuple with multiple values in its list, this uses the first one.


setBool

protected void setBool(String key,
                       boolean value)

getInstanceOf

public static <T> T getInstanceOf(Class<T> interFace,
                                  String uri,
                                  String root,
                                  String[][] stringArray)

getInstanceOf

public static <T> T getInstanceOf(Class<T> interFace,
                                  InputSource is,
                                  String root,
                                  String[][] stringArray)


Copyright © 2009. All Rights Reserved.