Class 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 boolean flattening
      The flattening flag for tags, i.e.
      protected boolean gentypetags
      Control flag for generating container tags.
      protected boolean prefertags
      Flag indicating if writing tags should be preferred wrt.
      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.
    • 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.
    • Constructor Detail

      • AbstractObjectWriterHandler

        public AbstractObjectWriterHandler​(boolean gentypetags,
                                           boolean prefertags,
                                           boolean flattening,
                                           java.util.Set typeinfos)
        Create a new writer handler.
    • Method Detail

      • getTypeInfo

        public TypeInfo getTypeInfo​(java.lang.Object object,
                                    QName[] fullpath,
                                    IContext context)
        Get the most specific mapping info.
        Specified by:
        getTypeInfo in interface IObjectWriterHandler
        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.
      • 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.
      • 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.