com.newstep.solid.util
public class XMLBeanDecoder
Utility to parse an xml based bean stream.
It uses the JavaBean getter/setter reflection
strategy to populate an object as long as the appropriate
methods have been defined, and the xml document has
the appropriate meta-information about populating said
JavaBean.
The bean class must conform to the JavaBean specification
specfically methods that "getField" is associated with the
the field "field". Similarly for set. The modifier MUST be
public. The bean must have a default (no-parameter) constructor.
See XMLBeanEncoder for a description
of the document schema that is acceptable.
This implementation uses DOM but may move to SAX. However, greatest
performance hit is reflecting the data into the bean.
This Decoder is not thread safe.
Author:
msimonsen
Links:
Kernel Association Association Link
Associates type:
association
Client cardinality:
1
Client navigability:
NOT NAVIGABLE
Client visibility:
private
Supplier cardinality:
1
Supplier navigability:
NAVIGABLE
Supplier visibility:
private
| Nested Class Summary |
class |
|
| Field Summary |
|
|
Logger |
|
private InputStream |
|
| Constructor Summary |
public void |
|
public void |
|
| Method Summary |
private Object |
|
public Object |
|
private String |
|
|
|
private void |
setAttribute(Object obj, String name, String type, Object value) |
private void |
|
private Object |
|
private void |
|
private Object |
|
private Collection |
|
Multiplicity:
1
private InputStream stream
Multiplicity:
1
Stereotype:
create
public void XMLBeanDecoder (InputStream stream)
Stereotype:
create
private Object castToPrimitive (String type, String value)
public Object decode ()
private String getPrimitiveValue (Element ele)
private void setAttribute (Object obj, String name, String type, Object value)
Throws:
IllegalAccessException
private void setPrimitive (Element ele, Object parentObj)
Throws:
IllegalAccessException
private void unmarshal (Element node, Object parentObj)
Throws:
InstantiationException,IllegalAccessException
private Object unmarshal (Element node)
Throws:
InstantiationException,IllegalAccessException
private Object unmarshalArray (Element ele)
Throws:
InstantiationException,IllegalAccessException
private Collection unmarshalCollection (Element node, Object parentObj, Collection col)
Throws:
InstantiationException,IllegalAccessException