Package jadex.xml.bean
Class BeanObjectReaderHandler
- java.lang.Object
- 
- jadex.xml.bean.BeanObjectReaderHandler
 
- 
- All Implemented Interfaces:
- IBulkObjectLinker,- IObjectLinker,- IObjectReaderHandler
 
 public class BeanObjectReaderHandler extends java.lang.Object implements IObjectReaderHandler Handler for reading XML into Java beans.
- 
- 
Field SummaryFields Modifier and Type Field Description protected IBeanIntrospectorintrospectorThe bean introspector.protected java.util.Set<java.lang.Object>no_typeinfosNo type infos.protected java.util.Map<IFilter<java.lang.Object>,IPostProcessor>postprocessorsThe filter based post processors.protected TypeInfoTypeManagertitmanagerThe type info manager.
 - 
Constructor SummaryConstructors Constructor 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.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPostProcessor(IFilter<java.lang.Object> filter, IPostProcessor processor)Add a post processor.voidbulkLinkObjects(java.lang.Object parent, java.util.List<LinkData> children, AReadContext context)Bulk link chilren to its parent.voidbulkLinkObjects(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.protected java.lang.ObjectconvertBulkValues(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.ObjectconvertContentObject(java.lang.String value, QName tag, AReadContext context)Convert an object to another type of object.protected java.lang.ObjectconvertValue(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.ObjectcreateObject(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.ObjectgetObjectType(java.lang.Object object, AReadContext context)Get the object typeIPostProcessor[]getPostProcessors(java.lang.Object object, java.lang.Object typeinfo)Get the post-processor.TypeInfogetTypeInfo(java.lang.Object object, QName[] fullpath, AReadContext context)Get the most specific mapping info.voidhandleAttributeValue(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 voidhandleBulkLinking(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 booleaninvokeBulkSetMethod(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 booleaninvokeSetMethod(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 booleanisCorrectAnonymousInnerClass(java.lang.Class<?> clazz, java.util.Map<java.lang.String,java.lang.String> rawattributes)Test if a class is the correct inner class.voidlinkObject(java.lang.Object object, java.lang.Object parent, java.lang.Object linkinfo, QName[] pathname, AReadContext context)Link an object to its parent.voidremovePostProcessor(IFilter<java.lang.Object> filter)Remove a post processor.protected booleansetBulkAttributeValues(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 booleansetBulkField(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 booleansetElementValue(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 booleansetField(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.
 
- 
- 
- 
Field Detail- 
titmanagerprotected TypeInfoTypeManager titmanager The type info manager.
 - 
no_typeinfosprotected java.util.Set<java.lang.Object> no_typeinfos No type infos.
 - 
introspectorprotected IBeanIntrospector introspector The bean introspector.
 - 
postprocessorsprotected java.util.Map<IFilter<java.lang.Object>,IPostProcessor> postprocessors The filter based post processors.
 
- 
 - 
Constructor Detail- 
BeanObjectReaderHandlerpublic BeanObjectReaderHandler() Create a new handler for custom XML formats.
 - 
BeanObjectReaderHandlerpublic BeanObjectReaderHandler(java.util.Set<TypeInfo> typeinfos) Create a new handler for Java XML supporting on-the-fly type info creation for arrays.
 
- 
 - 
Method Detail- 
getTypeInfopublic TypeInfo getTypeInfo(java.lang.Object object, QName[] fullpath, AReadContext context) Get the most specific mapping info.- Specified by:
- getTypeInfoin interface- IObjectReaderHandler
- Parameters:
- tag- The tag.
- fullpath- The full path.
- Returns:
- The most specific mapping info.
 
 - 
createObjectpublic 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.ExceptionCreate an object for the current tag.- Specified by:
- createObjectin interface- IObjectReaderHandler
- Parameters:
- type- The object type to create.
- root- Flag, if object should be root object.
- context- The context.
- Returns:
- The created object (or null for none).
- Throws:
- java.lang.Exception
 
 - 
getCorrectAnonymousInnerClassprotected 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.
 - 
isCorrectAnonymousInnerClassprotected 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.
 - 
getObjectTypepublic java.lang.Object getObjectType(java.lang.Object object, AReadContext context)Get the object type- Parameters:
- object- The object.
- Returns:
- The object type.
 
 - 
convertContentObjectpublic java.lang.Object convertContentObject(java.lang.String value, QName tag, AReadContext context) throws java.lang.ExceptionConvert an object to another type of object.- Specified by:
- convertContentObjectin interface- IObjectReaderHandler
- Throws:
- java.lang.Exception
 
 - 
handleAttributeValuepublic 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.ExceptionHandle the attribute of an object.- Specified by:
- handleAttributeValuein interface- IObjectReaderHandler
- Parameters:
- object- The object.
- attrname- The attribute name.
- attrval- The attribute value.
- attrinfo- The attribute info.
- context- The context.
- Throws:
- java.lang.Exception
 
 - 
linkObjectpublic void linkObject(java.lang.Object object, java.lang.Object parent, java.lang.Object linkinfo, QName[] pathname, AReadContext context) throws java.lang.ExceptionLink an object to its parent.- Specified by:
- linkObjectin interface- IObjectLinker
- Parameters:
- object- The object.
- parent- The parent object.
- linkinfo- The link info.
- tagname- The current tagname (for name guessing).
- context- The context.
- Throws:
- java.lang.Exception
 
 - 
bulkLinkObjectspublic void bulkLinkObjects(java.util.List<java.lang.Object> childs, java.lang.Object parent, java.lang.Object linkinfo, QName[] pathname, AReadContext context) throws java.lang.ExceptionLink an object to its parent.- Parameters:
- object- The object.
- parent- The parent object.
- linkinfo- The link info.
- tagname- The current tagname (for name guessing).
- context- The context.
- Throws:
- java.lang.Exception
 
 - 
bulkLinkObjectspublic void bulkLinkObjects(java.lang.Object parent, java.util.List<LinkData> children, AReadContext context) throws java.lang.ExceptionBulk link chilren to its parent.- Specified by:
- bulkLinkObjectsin interface- IBulkObjectLinker
- Parameters:
- parent- The parent object.
- children- The children objects (link datas).
- context- The context.
- classloader- The classloader.
- root- The root object.
- Throws:
- java.lang.Exception
 
 - 
handleBulkLinkingprotected 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.ExceptionInitiate the bulk link calls.- Throws:
- java.lang.Exception
 
 - 
setElementValueprotected 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.ExceptionSet an attribute value. Similar to handleAttributValue but allows objects as attribute values (for linking).- Parameters:
- attrinfo- The attribute info.
- xmlattrname- The xml attribute name.
- object- The object.
- val- The attribute value.
- root- The root object.
- classloader- The classloader.
- Throws:
- java.lang.Exception
 
 - 
setBulkAttributeValuesprotected 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.ExceptionSet an attribute value. Similar to handleAttributValue but allows objects as attribute values (for linking).- Parameters:
- attrinfo- The attribute info.
- xmlattrname- The xml attribute name.
- object- The object.
- attrval- The attribute value.
- root- The root object.
- classloader- The classloader.
- Throws:
- java.lang.Exception
 
 - 
invokeSetMethodprotected 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.ExceptionSet a value directly on a Java bean.- Parameters:
- prefixes- The method prefixes.
- postfix- The method postfix.
- value- The attribute value.
- object- The object.
- root- The root.
- classloader- The classloader.
- converter- The converter.
- Throws:
- java.lang.Exception
 
 - 
invokeBulkSetMethodprotected 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.ExceptionSet a value directly on a Java bean.- Parameters:
- prefixes- The method prefixes.
- postfix- The mothod postfix.
- attrval- The attribute value.
- object- The object.
- root- The root.
- classloader- The classloader.
- converter- The converter.
- Throws:
- java.lang.Exception
 
 - 
setFieldprotected 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.ExceptionDirectly access a field for setting/(adding) the object.- Throws:
- java.lang.Exception
 
 - 
setBulkFieldprotected 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.ExceptionDirectly access a field for setting the objects.- Throws:
- java.lang.Exception
 
 - 
convertValueprotected 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.ExceptionConvert a value by using a converter.- Parameters:
- val- The attribute value.
- targetcalss- The target class.
- converter- The converter.
- root- The root.
- classloader- The classloader.
- Throws:
- java.lang.Exception
 
 - 
convertBulkValuesprotected 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.ExceptionConvert a list of values into the target format (list, set, collection, array).- Throws:
- java.lang.Exception
 
 - 
getPostProcessorspublic IPostProcessor[] getPostProcessors(java.lang.Object object, java.lang.Object typeinfo) Get the post-processor.- Specified by:
- getPostProcessorsin interface- IObjectReaderHandler
- Returns:
- The post-processor
 
 - 
addPostProcessorpublic void addPostProcessor(IFilter<java.lang.Object> filter, IPostProcessor processor) Add a post processor.- Parameters:
- filter- The filter.
- processor- The post processor.
 
 - 
removePostProcessorpublic void removePostProcessor(IFilter<java.lang.Object> filter) Remove a post processor.- Parameters:
- filter- The filter.
- processor- The post processor.
 
 
- 
 
-