Class BasicPersister<T>

    • Constructor Summary

      Constructors 
      Constructor Description
      BasicPersister()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addError​(java.io.IOException err)  
      protected boolean canInstantiate​(java.lang.Class valueClazz)  
      protected void clearErrors()  
      java.lang.Object create​(java.lang.Object o)  
      org.w3c.dom.Attr createAttribute​(java.lang.String name)  
      org.w3c.dom.Element createElement​(java.lang.String name)  
      protected java.lang.Object createInstance​(java.lang.Object o)
      Default implementation: will create an instance using reflection.
      T createInstance​(org.openide.util.Lookup context, javax.xml.namespace.QName qName)  
      protected java.util.logging.Logger createLog()  
      IJCPersister.Reader createReader​(org.openide.util.Lookup context, java.lang.Class expectedType, org.w3c.dom.Node parent, com.im.commons.progress.DFEnvironmentRO env)
      Reader factory.
      org.w3c.dom.Element createState​(java.lang.Object bean, org.w3c.dom.Node parent)  
      IJCPersister.Writer createWriter​(org.openide.util.Lookup context, java.lang.Object bean, com.im.commons.progress.DFEnvironmentRO env)
      Writer factory.
      protected void defaultReadBean()  
      void defaultWriteBean()
      Iterates through BeanInfo and writes all property values.
      protected org.w3c.dom.Element enterElement​(java.lang.String name, org.openide.util.Lookup context)
      For readers: enter the named element, and establish the supplied context.
      protected void enterElement​(org.w3c.dom.Element e, org.openide.util.Lookup context)
      Enter the specified element and make it current.
      protected org.w3c.dom.Attr getAttribute()
      Returns the current attribute being written to or read from.
      protected java.lang.String getAttribute​(java.beans.PropertyDescriptor pd, java.lang.String propName, java.lang.String attr)
      Helper methods to retrieving metadata.
      protected T getBean()
      The bean instance being written or read.
      protected java.lang.Class getBeanClass()  
      java.util.List<java.io.IOException> getBufferedErrors()  
      protected java.lang.Class getClass​(java.lang.String name)
      A helper method to retrieve a Class object without throwing a CNFE.
      protected javax.xml.namespace.QName getConfiguredQName()  
      protected org.openide.util.Lookup getContext()
      Retrieves the current context.
      protected static java.lang.ClassLoader getCurrentClassLoader()  
      com.im.commons.progress.DFEnvironmentRO getEnv()  
      protected org.w3c.dom.Node getNode()
      Retrieves the current Node.
      PersisterRegistry getPersisterRegistry()
      Get PersistentRegistry for creating child factories.
      protected java.lang.Object getPropertyValue​(java.beans.PropertyDescriptor property)
      Helper method to retrieve property's value.
      javax.xml.namespace.QName getQName​(java.lang.Object bean)  
      protected org.w3c.dom.Element getStorage()
      Returns the current element being written to or read from.
      java.lang.Class getType​(org.w3c.dom.Node n)
      Returns the class, used to register this Persister, as the type for all handled nodes.
      IJCPersister init()
      Initializes the persister.
      boolean isPrimitive​(java.lang.Class clazz)
      The Basic persister does not support primitive serialization, as it works with beans with [multiple] properties.
      protected void leaveElement()
      protected java.lang.Object loadObject​(java.lang.Class clazz, org.w3c.dom.Node loadFrom, java.lang.Object prototype)
      Loads an object from the specified Node (attribute or element).
      protected void popElement()
      Pops an element.
      protected org.w3c.dom.Element pushElement​(java.lang.String name)
      Generates an element and makes it "current", so write* helper methods will all use it.
      java.lang.Object read​(java.lang.String name, java.lang.Object prototype)  
      boolean readAttr​(java.lang.String name, boolean defValue)  
      int readAttr​(java.lang.String name, int defValue)  
      java.lang.String readAttr​(java.lang.String name, java.lang.String defValue)  
      protected java.lang.Object readAttribute​(java.lang.Object prototype)  
      protected void readBeanProperties()  
      protected void readBeanProperty​(java.beans.PropertyDescriptor pd)  
      protected <ITEM> java.util.List<ITEM> readCollection​(java.lang.Class<ITEM> itemType, java.lang.String propertyName, boolean throwOnMissing)  
      protected java.util.Collection readCollection​(java.lang.Class implClazz, java.lang.Class itemType, java.lang.String name, java.lang.String itemName, java.util.Collection prototype)  
      protected java.util.Collection readCollection​(java.lang.Class implClazz, java.lang.Class itemType, java.lang.String name, java.util.Collection prototype, boolean throwOnMissing)
      Reads a collection of items.
      protected java.lang.Object readCollectionProperty​(java.beans.PropertyDescriptor pd)  
      protected java.lang.Object readElement​(java.lang.Object prototype)  
      protected java.lang.Object readMap​(java.lang.Class implClazz, java.lang.Class keyType, java.lang.Class valType, java.lang.String name, java.lang.String itemName, java.util.Map prototype)  
      protected java.lang.Object readMapProperty​(java.beans.PropertyDescriptor pd)  
      protected java.lang.Object readObjectPolymorphic​(java.lang.String childName, java.lang.Object prototype)  
      protected java.lang.Object readObjectStatic​(java.lang.Class type, java.lang.String name, java.lang.Object prototype)
      Reads a statically-typed Object from the current element.
      protected java.lang.Object readPrimitiveProperty​(java.beans.PropertyDescriptor pd)  
      protected void setBean​(T bean)
      Sets the bean instance.
      void setBeanClass​(java.lang.Class clazz)  
      void setClassBeanInfo​(java.beans.BeanInfo classBeanInfo)  
      protected void setContext​(org.openide.util.Lookup context)
      Sets a new context.
      void setEnv​(com.im.commons.progress.DFEnvironmentRO env)  
      protected void setNode​(org.w3c.dom.Node n)  
      void setPersisterRegistry​(PersisterRegistry persisterRegistry)
      Set PersistentRegistry for creating child factories.
      void setPropertyAttributes​(java.util.Map<java.lang.String,​java.lang.String> propertyAttributes)  
      void setQName​(javax.xml.namespace.QName qName)  
      protected void setStorage​(org.w3c.dom.Element storage)
      Sets the current element to a specific node.
      protected void storeObject​(org.w3c.dom.Element storeTo, java.lang.Object val)
      Stores object directly in the specified element (not in its sub-elements).
      protected void throwWrappedIOException​(java.lang.String reason, java.lang.Throwable cause)  
      protected void throwWrappedIOException​(java.lang.Throwable cause)  
      void write​(java.lang.String name, int value)  
      void write​(java.lang.String name, java.lang.String value)  
      org.w3c.dom.Node write​(java.lang.String name, org.w3c.dom.Node n)
      Writes the bean either into an Attribute, or to an Element.
      protected void writeArray​(java.beans.PropertyDescriptor pd, java.lang.String name, java.lang.String itemName, java.lang.Object[] val)
      Writes an array of objects.
      void writeAttr​(java.lang.String name, boolean value, boolean defValue)  
      void writeAttr​(java.lang.String name, int value)  
      void writeAttr​(java.lang.String name, int value, com.google.common.base.Optional<java.lang.Integer> defaultValue)  
      void writeAttr​(java.lang.String name, java.lang.String value)  
      void writeAttr​(java.lang.String name, java.lang.String value, java.lang.String defValue)  
      protected void writeAttribute()
      The basic bean persister does not support primitive writing.
      protected void writeCollection​(java.beans.PropertyDescriptor pd, java.lang.String itemName, java.util.Collection val)
      Writes a collection property.
      protected void writeCollection​(java.lang.Class staticType, java.lang.String name, java.lang.String itemName, java.util.Collection val)  
      protected void writeCollection​(java.lang.Class staticType, java.lang.String name, java.lang.String itemName, java.util.Enumeration val)
      Writes an enumeration property.
      protected void writeElement()
      This default implementation will invoke defaultWriteBean, which outputs all properties described by the class' BeanInfo.
      protected void writeMap​(java.beans.PropertyDescriptor pd, java.lang.String itemName, java.util.Map val)  
      protected void writeMap​(java.lang.Class keyType, java.lang.Class valueType, java.lang.String name, java.lang.String itemName, java.util.Map val)  
      protected void writeObject​(java.lang.Class implType, java.lang.String name, java.lang.Object val)
      Persist an object under the given name.
      protected void writeObjectPolymorphic​(java.lang.String name, java.lang.Object val)
      Writes an object in a way that permits reconstruction of subclasses of the data type on reading.
      protected void writeObjectStatic​(java.lang.String name, java.lang.Object val)
      Writes a static content of an object, as an attribute or an element, depending on the object's persister capabilities.
      void writeProperty​(java.beans.PropertyDescriptor property)
      Write a value described by the property descriptor.
      protected void writeSuperclass​(org.w3c.dom.Element where)
      This method will find and delegate to a superclass persister.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BasicPersister

        public BasicPersister()
    • Method Detail

      • getPersisterRegistry

        public PersisterRegistry getPersisterRegistry()
        Description copied from interface: IJCPersister
        Get PersistentRegistry for creating child factories.
        Specified by:
        getPersisterRegistry in interface IJCPersister
        Returns:
        persistent registry. If persistent registry is not set return PersistentRegistry.getDefault()
      • setPersisterRegistry

        public void setPersisterRegistry​(PersisterRegistry persisterRegistry)
        Description copied from interface: IJCPersister
        Set PersistentRegistry for creating child factories.
        Specified by:
        setPersisterRegistry in interface IJCPersister
        Parameters:
        persisterRegistry - default persistent registry
      • setPropertyAttributes

        public void setPropertyAttributes​(java.util.Map<java.lang.String,​java.lang.String> propertyAttributes)
        Specified by:
        setPropertyAttributes in interface BasicPersisterInit
      • setBeanClass

        public void setBeanClass​(java.lang.Class clazz)
                          throws java.beans.IntrospectionException
        Specified by:
        setBeanClass in interface BasicPersisterInit
        Throws:
        java.beans.IntrospectionException
      • createLog

        protected java.util.logging.Logger createLog()
      • addError

        protected void addError​(java.io.IOException err)
      • clearErrors

        protected void clearErrors()
      • getBufferedErrors

        public java.util.List<java.io.IOException> getBufferedErrors()
      • getEnv

        public com.im.commons.progress.DFEnvironmentRO getEnv()
      • setEnv

        public void setEnv​(com.im.commons.progress.DFEnvironmentRO env)
      • getCurrentClassLoader

        protected static java.lang.ClassLoader getCurrentClassLoader()
      • init

        public IJCPersister init()
        Initializes the persister. To be overriden by subclasses instead of the constructor, as the BasicBeanPersisters are instantiated using reflection :)
        Specified by:
        init in interface BasicPersisterInit
      • pushElement

        protected org.w3c.dom.Element pushElement​(java.lang.String name)
        Generates an element and makes it "current", so write* helper methods will all use it. Do not forget to call popElement() counterpart when done with the pushed element's contents.
      • enterElement

        protected org.w3c.dom.Element enterElement​(java.lang.String name,
                                                   org.openide.util.Lookup context)
        For readers: enter the named element, and establish the supplied context. Helper read* methods will read from that element and if they delegate, they will use the context.
        Returns:
        the element if it was found; null otherwise
      • enterElement

        protected void enterElement​(org.w3c.dom.Element e,
                                    org.openide.util.Lookup context)
        Enter the specified element and make it current. If Lookup is specified, the current context is changed to that Lookup. If null is given as a lookup, the current Lookup is retained. To clear the Lookup, pass in Lookup.EMPTY instance.
      • getAttribute

        protected final java.lang.String getAttribute​(java.beans.PropertyDescriptor pd,
                                                      java.lang.String propName,
                                                      java.lang.String attr)
        Helper methods to retrieving metadata. Metadata can be either stored as a named value in the BeanInfo or, if it is not feasible to change, the persister's propertyAttributesMap can contain the value under key "<property-name>%<attribute-name>". If none of the maps contains the requested attribute, null will be returned.
      • setBean

        protected void setBean​(T bean)
        Sets the bean instance. Use this method early in write implementation, so all other state methods can work with the bean. When reading, set the bean as soon as the result object is constructed.
      • getBean

        protected final T getBean()
        The bean instance being written or read.
      • getBeanClass

        protected java.lang.Class getBeanClass()
        Returns:
        The class of the bean that will be deserialized
      • setStorage

        protected void setStorage​(org.w3c.dom.Element storage)
        Sets the current element to a specific node. The method will reset the attribute property.
      • setNode

        protected void setNode​(org.w3c.dom.Node n)
      • getAttribute

        protected org.w3c.dom.Attr getAttribute()
        Returns the current attribute being written to or read from.
      • getStorage

        protected final org.w3c.dom.Element getStorage()
        Returns the current element being written to or read from.
      • setContext

        protected void setContext​(org.openide.util.Lookup context)
        Sets a new context. This method should be used just for setting up the persister; otherwise, push and pop methods should be used to manipulate synchronously with the element and context stacks.
      • getContext

        protected final org.openide.util.Lookup getContext()
        Retrieves the current context. Context can be used by the persister to discover its environment, to bind the deserialized bean to. Also it can be used by the serializer to discover which information is implicitly available in the environment (e.g. serializing a field within its Entity only requires the field ID - if the Entity instance is in the environment)
      • createWriter

        public IJCPersister.Writer createWriter​(org.openide.util.Lookup context,
                                                java.lang.Object bean,
                                                com.im.commons.progress.DFEnvironmentRO env)
        Writer factory. It clones self, and initializes the context and the bean being written.
        Specified by:
        createWriter in interface IJCPersister
      • createReader

        public IJCPersister.Reader createReader​(org.openide.util.Lookup context,
                                                java.lang.Class expectedType,
                                                org.w3c.dom.Node parent,
                                                com.im.commons.progress.DFEnvironmentRO env)
        Reader factory. It clones itself and initializes the context, and the current XML Node
        Specified by:
        createReader in interface IJCPersister
      • isPrimitive

        public boolean isPrimitive​(java.lang.Class clazz)
        The Basic persister does not support primitive serialization, as it works with beans with [multiple] properties. Subclasses tailored specifically for certain bean may override this.
        Specified by:
        isPrimitive in interface IJCPersister
        Returns:
        If true, the Factory is willing to write to an attribute
      • getType

        public java.lang.Class getType​(org.w3c.dom.Node n)
        Returns the class, used to register this Persister, as the type for all handled nodes.
        Specified by:
        getType in interface IJCPersister
        Returns:
        The type of the bean to be deserialized
      • getNode

        protected org.w3c.dom.Node getNode()
        Retrieves the current Node.
      • write

        public final org.w3c.dom.Node write​(java.lang.String name,
                                            org.w3c.dom.Node n)
                                     throws java.io.IOException
        Writes the bean either into an Attribute, or to an Element. If the passed Node is an attribute, it will try to persist the bean calling writeAttribute(). If the persister does not support primitive writing, a child element named "name" will be created to hold the bean's state. If the passed Node is an element, the bean's state is always stored to that element. Element is written by calling writeElement() overridable.
        Specified by:
        write in interface IJCPersister.Writer
        Parameters:
        name - The name
        n - The node
        Returns:
        The node
        Throws:
        java.io.IOException
      • writeAttribute

        protected void writeAttribute()
                               throws java.io.IOException
        The basic bean persister does not support primitive writing.
        Throws:
        java.io.IOException
      • writeElement

        protected void writeElement()
                             throws java.io.IOException
        This default implementation will invoke defaultWriteBean, which outputs all properties described by the class' BeanInfo.
        Throws:
        java.io.IOException
      • defaultWriteBean

        public void defaultWriteBean()
                              throws java.io.IOException
        Iterates through BeanInfo and writes all property values.
        Throws:
        java.io.IOException
      • getPropertyValue

        protected java.lang.Object getPropertyValue​(java.beans.PropertyDescriptor property)
                                             throws java.io.IOException
        Helper method to retrieve property's value. All reflection exceptions are wrapped into IOExceptions
        Throws:
        java.io.IOException
      • writeProperty

        public void writeProperty​(java.beans.PropertyDescriptor property)
                           throws java.io.IOException
        Write a value described by the property descriptor. Primitives, arrays and collections are handled specially. If the bean is a generic object, the static type information from the BeanInfo's value map is used to determine whether it can be written without type information.
        Throws:
        java.io.IOException
      • getClass

        protected java.lang.Class getClass​(java.lang.String name)
        A helper method to retrieve a Class object without throwing a CNFE. CNFE is expected in this case. The passed name may be null (null will be returned).
      • writeCollection

        protected void writeCollection​(java.lang.Class staticType,
                                       java.lang.String name,
                                       java.lang.String itemName,
                                       java.util.Enumeration val)
                                throws java.io.IOException
        Writes an enumeration property. It may surround the entire collection in a wrapper element (named "name"). Each item will be either named "itemName" (if the parameter is not null), or the default name "item" will be used. If the static type is not known in advance, the object will be written in a typed way - no default name item name will be used, as the collection only contains its items, no other elements.
        Parameters:
        staticType - The element type, if static
        name - The name of the wrapper element
        itemName - The name of the "item" element where item information will be stored.
        val - The enumeration of elements to be stored.
        Throws:
        java.io.IOException
      • writeMap

        protected void writeMap​(java.lang.Class keyType,
                                java.lang.Class valueType,
                                java.lang.String name,
                                java.lang.String itemName,
                                java.util.Map val)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • writeCollection

        protected void writeCollection​(java.lang.Class staticType,
                                       java.lang.String name,
                                       java.lang.String itemName,
                                       java.util.Collection val)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • canInstantiate

        protected boolean canInstantiate​(java.lang.Class valueClazz)
      • writeCollection

        protected void writeCollection​(java.beans.PropertyDescriptor pd,
                                       java.lang.String itemName,
                                       java.util.Collection val)
                                throws java.io.IOException
        Writes a collection property.
        Throws:
        java.io.IOException
      • writeMap

        protected void writeMap​(java.beans.PropertyDescriptor pd,
                                java.lang.String itemName,
                                java.util.Map val)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • writeArray

        protected void writeArray​(java.beans.PropertyDescriptor pd,
                                  java.lang.String name,
                                  java.lang.String itemName,
                                  java.lang.Object[] val)
                           throws java.io.IOException
        Writes an array of objects.
        Throws:
        java.io.IOException
      • writeObject

        protected final void writeObject​(java.lang.Class implType,
                                         java.lang.String name,
                                         java.lang.Object val)
                                  throws java.io.IOException
        Persist an object under the given name. The object may be written as an attribute, or an sub-element, if the implementation type is known (statically). If the implementation type is not known in advance, the object must be written as a dynamic content, using sub-element with proper tagname and namespace URI which allows to locate the appropriate persister on deserialization. Note that dynamically typed objects cannot be stored as attributes.
        Parameters:
        implType - The static type, or null if the type may vary (e.g. subclasses might be used)
        name - The attribute/child element name
        val - The object
        Throws:
        java.io.IOException
      • writeObjectPolymorphic

        protected final void writeObjectPolymorphic​(java.lang.String name,
                                                    java.lang.Object val)
                                             throws java.io.IOException
        Writes an object in a way that permits reconstruction of subclasses of the data type on reading. Such objects must be read using readObjectPolymorphic(java.lang.String, java.lang.Object), and are stored as a child element "name", whose sole child is a {namespace}tagname element defined by the value persister. Alternatively, the typed object's typed element is appended as a direct child, if the passed name is null.
        Throws:
        java.io.IOException
      • writeObjectStatic

        protected final void writeObjectStatic​(java.lang.String name,
                                               java.lang.Object val)
                                        throws java.io.IOException
        Writes a static content of an object, as an attribute or an element, depending on the object's persister capabilities. Note that this object must be restored by readObjectStatic(java.lang.Class, java.lang.String, java.lang.Object), using the specific class.
        Parameters:
        name - The name of the element or attribute
        val - The object
        Throws:
        java.io.IOException
      • loadObject

        protected java.lang.Object loadObject​(java.lang.Class clazz,
                                              org.w3c.dom.Node loadFrom,
                                              java.lang.Object prototype)
                                       throws java.io.IOException
        Loads an object from the specified Node (attribute or element). A prototype instance may be passed to populate with state or clone.
        Throws:
        java.io.IOException
      • storeObject

        protected void storeObject​(org.w3c.dom.Element storeTo,
                                   java.lang.Object val)
                            throws java.io.IOException
        Stores object directly in the specified element (not in its sub-elements). This is useful when a parent wants to annotate the child with additional properties
        Throws:
        java.io.IOException
      • createElement

        public org.w3c.dom.Element createElement​(java.lang.String name)
      • createAttribute

        public org.w3c.dom.Attr createAttribute​(java.lang.String name)
      • writeAttr

        public void writeAttr​(java.lang.String name,
                              int value,
                              com.google.common.base.Optional<java.lang.Integer> defaultValue)
      • writeAttr

        public void writeAttr​(java.lang.String name,
                              int value)
      • writeAttr

        public void writeAttr​(java.lang.String name,
                              boolean value,
                              boolean defValue)
      • write

        public void write​(java.lang.String name,
                          int value)
      • writeAttr

        public void writeAttr​(java.lang.String name,
                              java.lang.String value,
                              java.lang.String defValue)
      • writeAttr

        public void writeAttr​(java.lang.String name,
                              java.lang.String value)
      • readAttr

        public int readAttr​(java.lang.String name,
                            int defValue)
      • readAttr

        public java.lang.String readAttr​(java.lang.String name,
                                         java.lang.String defValue)
      • readAttr

        public boolean readAttr​(java.lang.String name,
                                boolean defValue)
      • write

        public void write​(java.lang.String name,
                          java.lang.String value)
      • createInstance

        public T createInstance​(org.openide.util.Lookup context,
                                javax.xml.namespace.QName qName)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • writeSuperclass

        protected void writeSuperclass​(org.w3c.dom.Element where)
                                throws java.io.IOException
        This method will find and delegate to a superclass persister.
        Throws:
        java.io.IOException
      • getQName

        public javax.xml.namespace.QName getQName​(java.lang.Object bean)
        Specified by:
        getQName in interface IJCPersister
        Returns:
        QName of the element to be created
      • getConfiguredQName

        protected javax.xml.namespace.QName getConfiguredQName()
      • createState

        public org.w3c.dom.Element createState​(java.lang.Object bean,
                                               org.w3c.dom.Node parent)
      • create

        public java.lang.Object create​(java.lang.Object o)
                                throws java.io.IOException
        Specified by:
        create in interface IJCPersister.Reader
        Throws:
        java.io.IOException
      • createInstance

        protected java.lang.Object createInstance​(java.lang.Object o)
                                           throws java.io.IOException
        Default implementation: will create an instance using reflection. If the passed prototype is not null, and is assignable to the persister's bean class, the prototype object will be returned instead of a new instance. Nothing will be created if the bean does not have a default constructor.
        Throws:
        java.io.IOException
      • read

        public final java.lang.Object read​(java.lang.String name,
                                           java.lang.Object prototype)
                                    throws java.io.IOException
        Specified by:
        read in interface IJCPersister.Reader
        Throws:
        java.io.IOException
      • readElement

        protected java.lang.Object readElement​(java.lang.Object prototype)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • readAttribute

        protected java.lang.Object readAttribute​(java.lang.Object prototype)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • readObjectStatic

        protected java.lang.Object readObjectStatic​(java.lang.Class type,
                                                    java.lang.String name,
                                                    java.lang.Object prototype)
                                             throws java.io.IOException
        Reads a statically-typed Object from the current element. It may load the object from a sub-element or an attribute, depending on the object's registered Persister
        Throws:
        java.io.IOException
      • defaultReadBean

        protected void defaultReadBean()
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • readBeanProperties

        protected void readBeanProperties()
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • readBeanProperty

        protected void readBeanProperty​(java.beans.PropertyDescriptor pd)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • readObjectPolymorphic

        protected java.lang.Object readObjectPolymorphic​(java.lang.String childName,
                                                         java.lang.Object prototype)
                                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • throwWrappedIOException

        protected void throwWrappedIOException​(java.lang.String reason,
                                               java.lang.Throwable cause)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • throwWrappedIOException

        protected void throwWrappedIOException​(java.lang.Throwable cause)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • readCollection

        protected java.util.Collection readCollection​(java.lang.Class implClazz,
                                                      java.lang.Class itemType,
                                                      java.lang.String name,
                                                      java.lang.String itemName,
                                                      java.util.Collection prototype)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • readCollection

        protected <ITEM> java.util.List<ITEM> readCollection​(java.lang.Class<ITEM> itemType,
                                                             java.lang.String propertyName,
                                                             boolean throwOnMissing)
                                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • readCollection

        protected java.util.Collection readCollection​(java.lang.Class implClazz,
                                                      java.lang.Class itemType,
                                                      java.lang.String name,
                                                      java.util.Collection prototype,
                                                      boolean throwOnMissing)
                                               throws java.io.IOException
        Reads a collection of items. If an item cannot be read, the whole operation fails with an exception. If the 'prototype' is not null, the method will read into that prototype collection instance rather than create a new instance. 'implClazz' provides a Class type of collection to be created. If the type is null or is an interface an ArrayList is instantiated. 'itemType' specifies the base type to be read - Persister for that type will be used to read the items. If not provided, the persister will be looked up according to the item's DOM element name.
        Parameters:
        implClazz - The type of the collection, or null when prototype is present or ArrayList should be used
        itemType - The type of the item, or null for polymorphic lookup
        name - The name of the wrapper DOM element, null if no wrapper
        prototype - The prototype collection instance
        Returns:
        The deserialized Collection
        Throws:
        java.io.IOException
      • readCollectionProperty

        protected java.lang.Object readCollectionProperty​(java.beans.PropertyDescriptor pd)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • readMapProperty

        protected java.lang.Object readMapProperty​(java.beans.PropertyDescriptor pd)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • readMap

        protected java.lang.Object readMap​(java.lang.Class implClazz,
                                           java.lang.Class keyType,
                                           java.lang.Class valType,
                                           java.lang.String name,
                                           java.lang.String itemName,
                                           java.util.Map prototype)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • readPrimitiveProperty

        protected java.lang.Object readPrimitiveProperty​(java.beans.PropertyDescriptor pd)
                                                  throws java.io.IOException
        Throws:
        java.io.IOException