Package jadex.xml.writer
Class AbstractObjectWriterHandler
- java.lang.Object
-
- jadex.xml.writer.AbstractObjectWriterHandler
-
- All Implemented Interfaces:
IObjectWriterHandler
- Direct Known Subclasses:
BeanObjectWriterHandler
,OAVObjectWriterHandler
public abstract class AbstractObjectWriterHandler extends java.lang.Object implements IObjectWriterHandler
Abstract base class for an object writer handler. Is object type agnostic and uses several abstract methods that have to be overridden by concrete handlers.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
flattening
The flattening flag for tags, i.e. generate always new containing tags or use one.protected boolean
gentypetags
Control flag for generating container tags.protected boolean
prefertags
Flag indicating if writing tags should be preferred wrt. attributes.protected TypeInfoTypeManager
titmanager
The type info manager.
-
Constructor Summary
Constructors Constructor Description AbstractObjectWriterHandler(boolean gentypetags, boolean prefertags, boolean flattening, java.util.Set typeinfos)
Create a new writer handler.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected QName[]
createPath(QName[] xmlpath, java.lang.Object value, IContext context)
Create a qname path.protected java.lang.Object
getDefaultValue(java.lang.Object property)
Get the default value.abstract java.lang.Object
getObjectType(java.lang.Object object, IContext context)
Get the object typeWriteObjectInfo
getObjectWriteInfo(java.lang.Object object, TypeInfo typeinfo, IContext context)
Get write info for an object.IPreProcessor[]
getPreProcessors(java.lang.Object object, java.lang.Object typeinfo)
Get the pre-processors.protected abstract java.util.Collection
getProperties(java.lang.Object object, IContext context, boolean includemethods, boolean includefields)
Get the properties of an object.protected abstract java.lang.Object
getProperty(java.lang.Object info)
Get the property.protected abstract java.lang.String
getPropertyName(java.lang.Object property)
Get the name of a property.TypeInfo
getTypeInfo(java.lang.Object object, QName[] fullpath, IContext context)
Get the most specific mapping info.TypeInfoTypeManager
getTypeInfoManager()
Get the titmanager.protected abstract java.lang.Object
getValue(java.lang.Object object, java.lang.Object attr, IContext context, java.lang.Object info)
Get a value from an object.protected abstract boolean
isBasicType(java.lang.Object property, java.lang.Object value)
Test is a value is a basic type (and can be mapped to an attribute).protected abstract boolean
isDecodableToSameType(java.lang.Object property, java.lang.Object value, IContext context)
Test if a value is decodable to the same type.protected abstract boolean
isTypeCompatible(java.lang.Object object, ObjectInfo info, IContext context)
Test if a value is compatible with the defined typeinfo.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jadex.xml.writer.IObjectWriterHandler
getTagName, getTagWithPrefix
-
-
-
-
Field Detail
-
gentypetags
protected boolean gentypetags
Control flag for generating container tags.
-
prefertags
protected boolean prefertags
Flag indicating if writing tags should be preferred wrt. attributes.
-
flattening
protected boolean flattening
The flattening flag for tags, i.e. generate always new containing tags or use one.
-
titmanager
protected TypeInfoTypeManager titmanager
The type info manager.
-
-
Method Detail
-
getTypeInfo
public TypeInfo getTypeInfo(java.lang.Object object, QName[] fullpath, IContext context)
Get the most specific mapping info.- Specified by:
getTypeInfo
in interfaceIObjectWriterHandler
- Parameters:
type
- The type.fullpath
- The full path.- Returns:
- The most specific mapping info.
-
getTypeInfoManager
public TypeInfoTypeManager getTypeInfoManager()
Get the titmanager.- Returns:
- The titmanager.
-
getObjectType
public abstract java.lang.Object getObjectType(java.lang.Object object, IContext context)
Get the object type- Parameters:
object
- The object.- Returns:
- The object type.
-
getObjectWriteInfo
public WriteObjectInfo getObjectWriteInfo(java.lang.Object object, TypeInfo typeinfo, IContext context) throws java.lang.Exception
Get write info for an object.- Specified by:
getObjectWriteInfo
in interfaceIObjectWriterHandler
- Parameters:
object
- The object.typeinfo
- The Typeinfo.- Throws:
java.lang.Exception
-
createPath
protected QName[] createPath(QName[] xmlpath, java.lang.Object value, IContext context)
Create a qname path.
-
getDefaultValue
protected java.lang.Object getDefaultValue(java.lang.Object property)
Get the default value.
-
getPreProcessors
public IPreProcessor[] getPreProcessors(java.lang.Object object, java.lang.Object typeinfo)
Get the pre-processors.- Specified by:
getPreProcessors
in interfaceIObjectWriterHandler
- Returns:
- The pre-processors.
-
getValue
protected abstract java.lang.Object getValue(java.lang.Object object, java.lang.Object attr, IContext context, java.lang.Object info) throws java.lang.Exception
Get a value from an object.- Throws:
java.lang.Exception
-
getProperty
protected abstract java.lang.Object getProperty(java.lang.Object info)
Get the property.
-
getPropertyName
protected abstract java.lang.String getPropertyName(java.lang.Object property)
Get the name of a property.
-
getProperties
protected abstract java.util.Collection getProperties(java.lang.Object object, IContext context, boolean includemethods, boolean includefields)
Get the properties of an object.
-
isBasicType
protected abstract boolean isBasicType(java.lang.Object property, java.lang.Object value)
Test is a value is a basic type (and can be mapped to an attribute).
-
isTypeCompatible
protected abstract boolean isTypeCompatible(java.lang.Object object, ObjectInfo info, IContext context)
Test if a value is compatible with the defined typeinfo.
-
isDecodableToSameType
protected abstract boolean isDecodableToSameType(java.lang.Object property, java.lang.Object value, IContext context)
Test if a value is decodable to the same type.
-
-