Package jadex.xml.writer
Class AbstractObjectWriterHandler
- java.lang.Object
-
- jadex.xml.writer.AbstractObjectWriterHandler
-
- All Implemented Interfaces:
IObjectWriterHandler
- Direct Known Subclasses:
BeanObjectWriterHandler
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 booleanflatteningThe flattening flag for tags, i.e.protected booleangentypetagsControl flag for generating container tags.protected booleanprefertagsFlag indicating if writing tags should be preferred wrt.protected TypeInfoTypeManagertitmanagerThe 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.ObjectgetDefaultValue(java.lang.Object property)Get the default value.abstract java.lang.ObjectgetObjectType(java.lang.Object object, IContext context)Get the object typeWriteObjectInfogetObjectWriteInfo(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.CollectiongetProperties(java.lang.Object object, IContext context, boolean includemethods, boolean includefields)Get the properties of an object.protected abstract java.lang.ObjectgetProperty(java.lang.Object info)Get the property.protected abstract java.lang.StringgetPropertyName(java.lang.Object property)Get the name of a property.TypeInfogetTypeInfo(java.lang.Object object, QName[] fullpath, IContext context)Get the most specific mapping info.TypeInfoTypeManagergetTypeInfoManager()Get the titmanager.protected abstract java.lang.ObjectgetValue(java.lang.Object object, java.lang.Object attr, IContext context, java.lang.Object info)Get a value from an object.protected abstract booleanisBasicType(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 booleanisDecodableToSameType(java.lang.Object property, java.lang.Object value, IContext context)Test if a value is decodable to the same type.protected abstract booleanisTypeCompatible(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:
getTypeInfoin 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:
getObjectWriteInfoin 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:
getPreProcessorsin 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.ExceptionGet 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.
-
-