public class BeanObjectReaderHandler extends java.lang.Object implements IObjectReaderHandler
Modifier and Type | Field and Description |
---|---|
protected IBeanIntrospector |
introspector
The bean introspector.
|
protected java.util.Set<java.lang.Object> |
no_typeinfos
No type infos.
|
protected java.util.Map<IFilter<java.lang.Object>,IPostProcessor> |
postprocessors
The filter based post processors.
|
protected TypeInfoTypeManager |
titmanager
The type info manager.
|
Constructor and Description |
---|
BeanObjectReaderHandler()
Create a new handler for custom XML formats.
|
BeanObjectReaderHandler(java.util.Set<TypeInfo> typeinfos)
Create a new handler for Java XML supporting on-the-fly
type info creation for arrays.
|
Modifier and Type | Method and Description |
---|---|
void |
addPostProcessor(IFilter<java.lang.Object> filter,
IPostProcessor processor)
Add a post processor.
|
void |
bulkLinkObjects(java.util.List<java.lang.Object> childs,
java.lang.Object parent,
java.lang.Object linkinfo,
QName[] pathname,
AReadContext context)
Link an object to its parent.
|
void |
bulkLinkObjects(java.lang.Object parent,
java.util.List<LinkData> children,
AReadContext context)
Bulk link chilren to its parent.
|
protected java.lang.Object |
convertBulkValues(java.util.List<java.lang.Object> vals,
java.lang.Class<?> targetclass,
java.lang.Object converter,
AReadContext context,
java.lang.String id)
Convert a list of values into the target format (list, set, collection, array).
|
java.lang.Object |
convertContentObject(java.lang.String value,
QName tag,
AReadContext context)
Convert an object to another type of object.
|
protected java.lang.Object |
convertValue(java.lang.Object val,
java.lang.Class<?> targetclass,
java.lang.Object converter,
AReadContext context,
java.lang.String id)
Convert a value by using a converter.
|
java.lang.Object |
createObject(java.lang.Object type,
boolean root,
AReadContext context,
java.util.Map<java.lang.String,java.lang.String> rawattributes)
Create an object for the current tag.
|
protected java.lang.Class<?> |
getCorrectAnonymousInnerClass(java.lang.Class<?> clazz,
java.util.Map<java.lang.String,java.lang.String> rawattributes,
java.lang.ClassLoader classloader)
Bug with Java compilers that enumerate anonymous inner classes as they like.
|
java.lang.Object |
getObjectType(java.lang.Object object,
AReadContext context)
Get the object type
|
IPostProcessor[] |
getPostProcessors(java.lang.Object object,
java.lang.Object typeinfo)
Get the post-processor.
|
TypeInfo |
getTypeInfo(java.lang.Object object,
QName[] fullpath,
AReadContext context)
Get the most specific mapping info.
|
void |
handleAttributeValue(java.lang.Object object,
QName xmlattrname,
java.util.List<QName> attrpath,
java.lang.String attrval,
java.lang.Object attrinfo,
AReadContext context)
Handle the attribute of an object.
|
protected void |
handleBulkLinking(java.util.List<java.lang.Object> childs,
java.lang.Object parent,
AReadContext context,
QName[] pathname,
java.util.List<LinkData> linkdatas,
int startidx)
Initiate the bulk link calls.
|
protected boolean |
invokeBulkSetMethod(java.lang.String[] prefixes,
java.lang.String postfix,
java.util.List<java.lang.Object> vals,
java.lang.Object object,
AReadContext context,
java.lang.Object converter,
java.lang.String idref)
Set a value directly on a Java bean.
|
protected boolean |
invokeSetMethod(java.lang.String[] prefixes,
java.lang.String postfix,
java.lang.Object value,
java.lang.Object object,
AReadContext context,
java.lang.Object converter,
java.lang.String idref)
Set a value directly on a Java bean.
|
protected boolean |
isCorrectAnonymousInnerClass(java.lang.Class<?> clazz,
java.util.Map<java.lang.String,java.lang.String> rawattributes)
Test if a class is the correct inner class.
|
void |
linkObject(java.lang.Object object,
java.lang.Object parent,
java.lang.Object linkinfo,
QName[] pathname,
AReadContext context)
Link an object to its parent.
|
void |
removePostProcessor(IFilter<java.lang.Object> filter)
Remove a post processor.
|
protected boolean |
setBulkAttributeValues(java.lang.Object accessinfo,
QName xmlattrname,
java.lang.Object object,
java.util.List<java.lang.Object> vals,
java.lang.Object converter,
java.lang.String id,
AReadContext context)
Set an attribute value.
|
protected boolean |
setBulkField(java.lang.String fieldname,
java.lang.Object parent,
java.util.List<java.lang.Object> objects,
java.lang.Object converter,
AReadContext context,
java.lang.String idref)
Directly access a field for setting the objects.
|
protected boolean |
setElementValue(java.lang.Object accessinfo,
QName xmlname,
java.lang.Object object,
java.lang.Object val,
java.lang.Object converter,
java.lang.String id,
AReadContext context)
Set an attribute value.
|
protected boolean |
setField(java.lang.String fieldname,
java.lang.Object parent,
java.lang.Object object,
java.lang.Object converter,
AReadContext context,
java.lang.String idref)
Directly access a field for setting/(adding) the object.
|
protected TypeInfoTypeManager titmanager
protected java.util.Set<java.lang.Object> no_typeinfos
protected IBeanIntrospector introspector
protected java.util.Map<IFilter<java.lang.Object>,IPostProcessor> postprocessors
public BeanObjectReaderHandler()
public BeanObjectReaderHandler(java.util.Set<TypeInfo> typeinfos)
public TypeInfo getTypeInfo(java.lang.Object object, QName[] fullpath, AReadContext context)
getTypeInfo
in interface IObjectReaderHandler
tag
- The tag.fullpath
- The full path.public java.lang.Object createObject(java.lang.Object type, boolean root, AReadContext context, java.util.Map<java.lang.String,java.lang.String> rawattributes) throws java.lang.Exception
createObject
in interface IObjectReaderHandler
type
- The object type to create.root
- Flag, if object should be root object.context
- The context.java.lang.Exception
protected java.lang.Class<?> getCorrectAnonymousInnerClass(java.lang.Class<?> clazz, java.util.Map<java.lang.String,java.lang.String> rawattributes, java.lang.ClassLoader classloader)
protected boolean isCorrectAnonymousInnerClass(java.lang.Class<?> clazz, java.util.Map<java.lang.String,java.lang.String> rawattributes)
public java.lang.Object getObjectType(java.lang.Object object, AReadContext context)
object
- The object.public java.lang.Object convertContentObject(java.lang.String value, QName tag, AReadContext context) throws java.lang.Exception
convertContentObject
in interface IObjectReaderHandler
java.lang.Exception
public void handleAttributeValue(java.lang.Object object, QName xmlattrname, java.util.List<QName> attrpath, java.lang.String attrval, java.lang.Object attrinfo, AReadContext context) throws java.lang.Exception
handleAttributeValue
in interface IObjectReaderHandler
object
- The object.attrname
- The attribute name.attrval
- The attribute value.attrinfo
- The attribute info.context
- The context.java.lang.Exception
public void linkObject(java.lang.Object object, java.lang.Object parent, java.lang.Object linkinfo, QName[] pathname, AReadContext context) throws java.lang.Exception
linkObject
in interface IObjectLinker
object
- The object.parent
- The parent object.linkinfo
- The link info.tagname
- The current tagname (for name guessing).context
- The context.java.lang.Exception
public void bulkLinkObjects(java.util.List<java.lang.Object> childs, java.lang.Object parent, java.lang.Object linkinfo, QName[] pathname, AReadContext context) throws java.lang.Exception
object
- The object.parent
- The parent object.linkinfo
- The link info.tagname
- The current tagname (for name guessing).context
- The context.java.lang.Exception
public void bulkLinkObjects(java.lang.Object parent, java.util.List<LinkData> children, AReadContext context) throws java.lang.Exception
bulkLinkObjects
in interface IBulkObjectLinker
parent
- The parent object.children
- The children objects (link datas).context
- The context.classloader
- The classloader.root
- The root object.java.lang.Exception
protected void handleBulkLinking(java.util.List<java.lang.Object> childs, java.lang.Object parent, AReadContext context, QName[] pathname, java.util.List<LinkData> linkdatas, int startidx) throws java.lang.Exception
java.lang.Exception
protected boolean setElementValue(java.lang.Object accessinfo, QName xmlname, java.lang.Object object, java.lang.Object val, java.lang.Object converter, java.lang.String id, AReadContext context) throws java.lang.Exception
attrinfo
- The attribute info.xmlattrname
- The xml attribute name.object
- The object.val
- The attribute value.root
- The root object.classloader
- The classloader.java.lang.Exception
protected boolean setBulkAttributeValues(java.lang.Object accessinfo, QName xmlattrname, java.lang.Object object, java.util.List<java.lang.Object> vals, java.lang.Object converter, java.lang.String id, AReadContext context) throws java.lang.Exception
attrinfo
- The attribute info.xmlattrname
- The xml attribute name.object
- The object.attrval
- The attribute value.root
- The root object.classloader
- The classloader.java.lang.Exception
protected boolean invokeSetMethod(java.lang.String[] prefixes, java.lang.String postfix, java.lang.Object value, java.lang.Object object, AReadContext context, java.lang.Object converter, java.lang.String idref) throws java.lang.Exception
prefixes
- The method prefixes.postfix
- The method postfix.value
- The attribute value.object
- The object.root
- The root.classloader
- The classloader.converter
- The converter.java.lang.Exception
protected boolean invokeBulkSetMethod(java.lang.String[] prefixes, java.lang.String postfix, java.util.List<java.lang.Object> vals, java.lang.Object object, AReadContext context, java.lang.Object converter, java.lang.String idref) throws java.lang.Exception
prefixes
- The method prefixes.postfix
- The mothod postfix.attrval
- The attribute value.object
- The object.root
- The root.classloader
- The classloader.converter
- The converter.java.lang.Exception
protected boolean setField(java.lang.String fieldname, java.lang.Object parent, java.lang.Object object, java.lang.Object converter, AReadContext context, java.lang.String idref) throws java.lang.Exception
java.lang.Exception
protected boolean setBulkField(java.lang.String fieldname, java.lang.Object parent, java.util.List<java.lang.Object> objects, java.lang.Object converter, AReadContext context, java.lang.String idref) throws java.lang.Exception
java.lang.Exception
protected java.lang.Object convertValue(java.lang.Object val, java.lang.Class<?> targetclass, java.lang.Object converter, AReadContext context, java.lang.String id) throws java.lang.Exception
val
- The attribute value.targetcalss
- The target class.converter
- The converter.root
- The root.classloader
- The classloader.java.lang.Exception
protected java.lang.Object convertBulkValues(java.util.List<java.lang.Object> vals, java.lang.Class<?> targetclass, java.lang.Object converter, AReadContext context, java.lang.String id) throws java.lang.Exception
java.lang.Exception
public IPostProcessor[] getPostProcessors(java.lang.Object object, java.lang.Object typeinfo)
getPostProcessors
in interface IObjectReaderHandler
public void addPostProcessor(IFilter<java.lang.Object> filter, IPostProcessor processor)
filter
- The filter.processor
- The post processor.public void removePostProcessor(IFilter<java.lang.Object> filter)
filter
- The filter.processor
- The post processor.