| java.lang.Object com.wutka.jox.JOXBeanInput
JOXBeanInput | class JOXBeanInput (Code) | | Performs the actual reading of an XML document and copies the
values into a bean. This class uses the DocumentBuilder portion
of the Java XML API. It is not as efficient as SAX, but much easier
to deal with when copying values into beans.
author: Mark Wutka version: 1.0 05/08/2000 version: 1.1 05/09/2000 version: 1.6 07/30/2000 |
Method Summary | |
public static String | getElementString(Element element) Searches the children of an element looking for a Text node. | public Object | getObjectValue(PropertyDescriptor desc, Element element) Examines a property's type to see which method should be used
to parse the property's value. | public Object | getObjectValue(PropertyDescriptor desc, String value) Examines a property's type to see which method should be used
to parse the property's value. | public static boolean | namesMatch(String beanName, String elementName) Returns true if two names match without regard to case or the
presence of '-' or '_' characters. | public static Object | parseBasicType(Class type, String str) | public Object | parseDate(String str, DateFormat dateFormat) | public static Object | readBasicType(Class type, Element element) | public Object | readDate(Element element) | public void | readIndexedProperty(Object ob, IndexedPropertyDescriptor desc, NodeList nodes, NamedNodeMap attrs) Reads XML element(s) into an indexed bean property by first locating
the XML element(s) corresponding to this property. | public void | readObject(Object ob, InputSource source) | public void | readObject(Object ob, Element element) Reads the children of an XML element and matches them to properties
of a bean. | public void | readProperty(Object ob, PropertyDescriptor desc, NodeList nodes, NamedNodeMap attrs) Reads an XML element into a bean property by first locating the
XML element corresponding to this property. |
getElementString | public static String getElementString(Element element)(Code) | | Searches the children of an element looking for a Text node. If
it finds one, it returns it.
Parameters: element - The element whose children will be searched The text for the element, or null if there is none |
getObjectValue | public Object getObjectValue(PropertyDescriptor desc, Element element) throws IOException(Code) | | Examines a property's type to see which method should be used
to parse the property's value.
Parameters: desc - The description of the property Parameters: element - The XML element containing the property value The value stored in the element throws: IOException - If there is an error reading the document |
getObjectValue | public Object getObjectValue(PropertyDescriptor desc, String value) throws IOException(Code) | | Examines a property's type to see which method should be used
to parse the property's value.
Parameters: desc - The description of the property Parameters: value - The value of the XML attribute containing the prop value The value stored in the element throws: IOException - If there is an error reading the document |
namesMatch | public static boolean namesMatch(String beanName, String elementName)(Code) | | Returns true if two names match without regard to case or the
presence of '-' or '_' characters.
Parameters: beanName - The name of the bean property to compare Parameters: elementName - The name of the element to compare True if the names match |
parseBasicType | public static Object parseBasicType(Class type, String str)(Code) | | Reads an string into a basic type
Parameters: type - The type of the string to read Parameters: str - The string containing the value The parsed value of the string |
parseDate | public Object parseDate(String str, DateFormat dateFormat) throws IOException(Code) | | Parses a string as a date
Parameters: str - The string containing the date The date value parsed from the string throws: IOException - If there's an error parsing the date |
readBasicType | public static Object readBasicType(Class type, Element element)(Code) | | Reads an XML text element into a basic type
Parameters: type - The type of the element to read Parameters: element - The element containing the value The parsed value of the element |
readDate | public Object readDate(Element element) throws IOException(Code) | | Parses an XML element as a date
Parameters: element - The element containing the date The date value parsed from the element throws: IOException - If there's an error parsing the date |
readIndexedProperty | public void readIndexedProperty(Object ob, IndexedPropertyDescriptor desc, NodeList nodes, NamedNodeMap attrs) throws IOException(Code) | | Reads XML element(s) into an indexed bean property by first locating
the XML element(s) corresponding to this property.
Parameters: ob - The bean whose property is being set Parameters: desc - The property that will be set Parameters: nodes - The list of XML items that may contain the property throws: IOException - If there is an error reading the document |
readObject | public void readObject(Object ob, InputSource source) throws IOException(Code) | | Reads an XML document from an input source and copies its
values into the specified object
Parameters: ob - The object to receive the values Parameters: source - The location of the XML document throws: IOException - If there is an error reading the document |
readObject | public void readObject(Object ob, Element element) throws IOException(Code) | | Reads the children of an XML element and matches them to properties
of a bean.
Parameters: ob - The bean to receive the values Parameters: element - The element the corresponds to the bean throws: IOException - If there is an error reading the document |
readProperty | public void readProperty(Object ob, PropertyDescriptor desc, NodeList nodes, NamedNodeMap attrs) throws IOException(Code) | | Reads an XML element into a bean property by first locating the
XML element corresponding to this property.
Parameters: ob - The bean whose property is being set Parameters: desc - The property that will be set Parameters: nodes - The list of XML items that may contain the property throws: IOException - If there is an error reading the document |
|
|