Class
Tree
          
PREV CLASS NEXT CLASS
SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD
 

com.newstep.solid.util
Class XMLBeanDecoder

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
to Interface XMLBeanExceptionHandler
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
XMLBeanDecoder(InputStream stream, XMLBeanExceptionHandler handler)
public void
XMLBeanDecoder(InputStream stream)
Method Summary
private Object
castToPrimitive(String type, String value)
public Object
private String
getPrimitiveValue(Element ele)
handle(Exception e)
private void
setAttribute(Object obj, String name, String type, Object value)
private void
setPrimitive(Element ele, Object parentObj)
private Object
unmarshal(Element node)
private void
unmarshal(Element node, Object parentObj)
private Object
unmarshalArray(Element ele)
private Collection
unmarshalCollection(Element node, Object parentObj, Collection col)
Field Detail
exHandler
private XMLBeanExceptionHandler exHandler
Multiplicity:
1
 

stream
private InputStream stream
Multiplicity:
1
 
Constructor Detail
XMLBeanDecoder
public void XMLBeanDecoder (InputStream stream, XMLBeanExceptionHandler handler)
 
Stereotype:
create
 

XMLBeanDecoder
public void XMLBeanDecoder (InputStream stream)
 
Stereotype:
create
 
Method Detail
castToPrimitive
private Object castToPrimitive (String type, String value)
 
 

decode
public Object decode ()
 
 

getPrimitiveValue
private String getPrimitiveValue (Element ele)
 
 

setAttribute
private void setAttribute (Object obj, String name, String type, Object value)
 
Throws:
IllegalAccessException
 

setPrimitive
private void setPrimitive (Element ele, Object parentObj)
 
Throws:
IllegalAccessException
 

unmarshal
private void unmarshal (Element node, Object parentObj)
 
Throws:
InstantiationException,IllegalAccessException
 

unmarshal
private Object unmarshal (Element node)
 
Throws:
InstantiationException,IllegalAccessException
 

unmarshalArray
private Object unmarshalArray (Element ele)
 
Throws:
InstantiationException,IllegalAccessException
 

unmarshalCollection
private Collection unmarshalCollection (Element node, Object parentObj, Collection col)
 
Throws:
InstantiationException,IllegalAccessException
 

Class
Tree
          
PREV CLASS NEXT CLASS
SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD