Package jadex.xml.bean
Class BeanObjectWriterHandler
- java.lang.Object
-
- jadex.xml.writer.AbstractObjectWriterHandler
-
- jadex.xml.bean.BeanObjectWriterHandler
-
- All Implemented Interfaces:
IObjectWriterHandler
public class BeanObjectWriterHandler extends AbstractObjectWriterHandler
Java bean version for fetching write info for an object.
-
-
Field Summary
Fields Modifier and Type Field Description protected jadex.commons.transformation.traverser.IBeanIntrospectorintrospectorThe bean introspector (also scans for public fields).protected java.util.Set<java.lang.Class<?>>no_typeinfosNo type infos.protected java.util.Map<IFilter<java.lang.Object>,IPreProcessor>preprocessorsThe filter based post processors.-
Fields inherited from class jadex.xml.writer.AbstractObjectWriterHandler
flattening, gentypetags, prefertags, titmanager
-
-
Constructor Summary
Constructors Constructor Description BeanObjectWriterHandler(java.util.Set<TypeInfo> typeinfos)Create a new writer (gentypetags=false, prefertags=true, flattening=true).BeanObjectWriterHandler(java.util.Set<TypeInfo> typeinfos, boolean gentypetags)Create a new writer (prefertags=true, flattening=true).BeanObjectWriterHandler(java.util.Set<TypeInfo> typeinfos, boolean gentypetags, boolean prefertags)Create a new writer (flattening=true).BeanObjectWriterHandler(java.util.Set<TypeInfo> typeinfos, boolean gentypetags, boolean prefertags, boolean flattening)Create a new writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPreProcessor(IFilter<java.lang.Object> filter, IPreProcessor processor)Add a pre processor.protected java.lang.reflect.MethodfindGetMethod(java.lang.Object object, java.lang.String name, java.lang.String[] prefixes)Find a get method with some prefix.java.lang.ObjectgetObjectType(java.lang.Object object, IContext context)Get the object typeIPreProcessor[]getPreProcessors(java.lang.Object object, java.lang.Object typeinfo)Get the pre-processor.protected java.util.Collection<jadex.commons.transformation.traverser.BeanProperty>getProperties(java.lang.Object object, IContext context, boolean includemethods, boolean includefields)Get the properties of an object.protected java.lang.ObjectgetProperty(java.lang.Object info)Get the property.protected java.lang.StringgetPropertyName(java.lang.Object property)Get the name of a property.QNamegetTagName(java.lang.Object object, IContext context)Get the tag name for an object.QNamegetTagWithPrefix(QName tag, IContext context)Get the tag with namespace.TypeInfogetTypeInfo(java.lang.Object object, QName[] fullpath, IContext context)Get the most specific mapping info.protected java.lang.ObjectgetValue(java.lang.Object object, java.lang.Object attr, IContext context, java.lang.Object info)Get a value from an object.protected booleanisBasicType(java.lang.Object property, java.lang.Object value)Test if a value is a basic type.protected booleanisDecodableToSameType(java.lang.Object property, java.lang.Object value, IContext context)Test if a value is decodable to the same type.protected booleanisTypeCompatible(java.lang.Object object, ObjectInfo info, IContext context)Test if a value is compatible with the defined typeinfo.voidremovePreProcessor(IFilter<java.lang.Object> filter)Remove a pre processor.-
Methods inherited from class jadex.xml.writer.AbstractObjectWriterHandler
createPath, getDefaultValue, getObjectWriteInfo, getTypeInfoManager
-
-
-
-
Field Detail
-
introspector
protected jadex.commons.transformation.traverser.IBeanIntrospector introspector
The bean introspector (also scans for public fields).
-
no_typeinfos
protected java.util.Set<java.lang.Class<?>> no_typeinfos
No type infos.
-
preprocessors
protected java.util.Map<IFilter<java.lang.Object>,IPreProcessor> preprocessors
The filter based post processors.
-
-
Constructor Detail
-
BeanObjectWriterHandler
public BeanObjectWriterHandler(java.util.Set<TypeInfo> typeinfos)
Create a new writer (gentypetags=false, prefertags=true, flattening=true).
-
BeanObjectWriterHandler
public BeanObjectWriterHandler(java.util.Set<TypeInfo> typeinfos, boolean gentypetags)
Create a new writer (prefertags=true, flattening=true).
-
BeanObjectWriterHandler
public BeanObjectWriterHandler(java.util.Set<TypeInfo> typeinfos, boolean gentypetags, boolean prefertags)
Create a new writer (flattening=true).
-
BeanObjectWriterHandler
public BeanObjectWriterHandler(java.util.Set<TypeInfo> typeinfos, boolean gentypetags, boolean prefertags, boolean flattening)
Create a new writer.
-
-
Method Detail
-
getTypeInfo
public TypeInfo getTypeInfo(java.lang.Object object, QName[] fullpath, IContext context)
Get the most specific mapping info.- Specified by:
getTypeInfoin interfaceIObjectWriterHandler- Overrides:
getTypeInfoin classAbstractObjectWriterHandler- Parameters:
tag- The tag.fullpath- The full path.- Returns:
- The most specific mapping info.
-
getObjectType
public java.lang.Object getObjectType(java.lang.Object object, IContext context)Get the object type- Specified by:
getObjectTypein classAbstractObjectWriterHandler- Parameters:
object- The object.- Returns:
- The object type.
-
getTagName
public QName getTagName(java.lang.Object object, IContext context)
Get the tag name for an object.
-
getTagWithPrefix
public QName getTagWithPrefix(QName tag, IContext context)
Get the tag with namespace.
-
getValue
protected java.lang.Object getValue(java.lang.Object object, java.lang.Object attr, IContext context, java.lang.Object info) throws java.lang.ExceptionGet a value from an object.- Specified by:
getValuein classAbstractObjectWriterHandler- Throws:
java.lang.Exception
-
getProperty
protected java.lang.Object getProperty(java.lang.Object info)
Get the property.- Specified by:
getPropertyin classAbstractObjectWriterHandler
-
getPropertyName
protected java.lang.String getPropertyName(java.lang.Object property)
Get the name of a property.- Specified by:
getPropertyNamein classAbstractObjectWriterHandler
-
isBasicType
protected boolean isBasicType(java.lang.Object property, java.lang.Object value)Test if a value is a basic type.- Specified by:
isBasicTypein classAbstractObjectWriterHandler
-
getProperties
protected java.util.Collection<jadex.commons.transformation.traverser.BeanProperty> getProperties(java.lang.Object object, IContext context, boolean includemethods, boolean includefields)Get the properties of an object.- Specified by:
getPropertiesin classAbstractObjectWriterHandler
-
findGetMethod
protected java.lang.reflect.Method findGetMethod(java.lang.Object object, java.lang.String name, java.lang.String[] prefixes)Find a get method with some prefix.- Parameters:
object- The object.name- The name.prefixes- The prefixes to test.
-
isTypeCompatible
protected boolean isTypeCompatible(java.lang.Object object, ObjectInfo info, IContext context)Test if a value is compatible with the defined typeinfo.- Specified by:
isTypeCompatiblein classAbstractObjectWriterHandler
-
isDecodableToSameType
protected boolean isDecodableToSameType(java.lang.Object property, java.lang.Object value, IContext context)Test if a value is decodable to the same type. Works for basic (final) types only and checks if the two types are of same class.- Specified by:
isDecodableToSameTypein classAbstractObjectWriterHandler
-
getPreProcessors
public IPreProcessor[] getPreProcessors(java.lang.Object object, java.lang.Object typeinfo)
Get the pre-processor.- Specified by:
getPreProcessorsin interfaceIObjectWriterHandler- Overrides:
getPreProcessorsin classAbstractObjectWriterHandler- Returns:
- The pre-processor
-
addPreProcessor
public void addPreProcessor(IFilter<java.lang.Object> filter, IPreProcessor processor)
Add a pre processor.- Parameters:
filter- The filter.processor- The pre processor.
-
removePreProcessor
public void removePreProcessor(IFilter<java.lang.Object> filter)
Remove a pre processor.- Parameters:
filter- The filter.processor- The pre processor.
-
-