Class StoreAppender

    • Constructor Summary

      Constructors 
      Constructor Description
      StoreAppender()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.Object checkAttribute​(StoreDescription desc, java.beans.PropertyDescriptor descriptor, java.lang.String attributeName, java.lang.Object bean, java.lang.Object bean2)
      Check if the attribute should be printed.
      java.lang.Object defaultInstance​(java.lang.Object bean)
      Generate default Instance for the specified bean.
      protected boolean isPersistable​(java.lang.Class<?> clazz)
      Is the specified property type one for which we should generate a persistence attribute?
      boolean isPrintValue​(java.lang.Object bean, java.lang.Object bean2, java.lang.String attrName, StoreDescription desc)
      Determine if the attribute value needs to be stored.
      protected void printAttribute​(java.io.PrintWriter writer, int indent, java.lang.Object bean, StoreDescription desc, java.lang.String attributeName, java.lang.Object bean2, java.lang.Object value)
      Store the specified of the specified JavaBean.
      void printAttributes​(java.io.PrintWriter writer, int indent, boolean include, java.lang.Object bean, StoreDescription desc)
      Store the relevant attributes of the specified JavaBean.
      void printAttributes​(java.io.PrintWriter writer, int indent, java.lang.Object bean, StoreDescription desc)
      Store the relevant attributes of the specified JavaBean, plus a className attribute defining the fully qualified Java class name of the bean.
      void printCloseTag​(java.io.PrintWriter aWriter, StoreDescription aDesc)
      Print the closing tag.
      void printIndent​(java.io.PrintWriter aWriter, int indent)
      Print some spaces.
      void printOpenTag​(java.io.PrintWriter aWriter, int indent, java.lang.Object bean, StoreDescription aDesc)
      Print only the open tag with all attributes.
      void printTag​(java.io.PrintWriter aWriter, int indent, java.lang.Object bean, StoreDescription aDesc)
      Print tag with all attributes
      void printTagArray​(java.io.PrintWriter aWriter, java.lang.String tag, int indent, java.lang.String[] elements)
      Print an array of elements.
      void printTagContent​(java.io.PrintWriter aWriter, java.lang.String tag, java.lang.String content)
      Print the value from tag as content.
      void printTagValueArray​(java.io.PrintWriter aWriter, java.lang.String tag, int indent, java.lang.String[] elements)
      Print an array of values.
      void printValue​(java.io.PrintWriter writer, int indent, java.lang.String name, java.lang.Object value)
      Print an attribute value.
      • Methods inherited from class java.lang.Object

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

      • StoreAppender

        public StoreAppender()
    • Method Detail

      • printCloseTag

        public void printCloseTag​(java.io.PrintWriter aWriter,
                                  StoreDescription aDesc)
                           throws java.lang.Exception
        Print the closing tag.
        Parameters:
        aWriter - The output writer
        aDesc - Store description of the current element
        Throws:
        java.lang.Exception - A store error occurred
      • printOpenTag

        public void printOpenTag​(java.io.PrintWriter aWriter,
                                 int indent,
                                 java.lang.Object bean,
                                 StoreDescription aDesc)
                          throws java.lang.Exception
        Print only the open tag with all attributes.
        Parameters:
        aWriter - The output writer
        indent - Indentation level
        bean - The current bean that is stored
        aDesc - Store description of the current element
        Throws:
        java.lang.Exception - A store error occurred
      • printTag

        public void printTag​(java.io.PrintWriter aWriter,
                             int indent,
                             java.lang.Object bean,
                             StoreDescription aDesc)
                      throws java.lang.Exception
        Print tag with all attributes
        Parameters:
        aWriter - The output writer
        indent - Indentation level
        bean - The current bean that is stored
        aDesc - Store description of the current element
        Throws:
        java.lang.Exception - A store error occurred
      • printTagContent

        public void printTagContent​(java.io.PrintWriter aWriter,
                                    java.lang.String tag,
                                    java.lang.String content)
                             throws java.lang.Exception
        Print the value from tag as content.
        Parameters:
        aWriter - The output writer
        tag - The element name
        content - Element content
        Throws:
        java.lang.Exception - A store error occurred
      • printTagValueArray

        public void printTagValueArray​(java.io.PrintWriter aWriter,
                                       java.lang.String tag,
                                       int indent,
                                       java.lang.String[] elements)
        Print an array of values.
        Parameters:
        aWriter - The output writer
        tag - The element name
        indent - Indentation level
        elements - Array of element values
      • printTagArray

        public void printTagArray​(java.io.PrintWriter aWriter,
                                  java.lang.String tag,
                                  int indent,
                                  java.lang.String[] elements)
                           throws java.lang.Exception
        Print an array of elements.
        Parameters:
        aWriter - The output writer
        tag - The element name
        indent - Indentation level
        elements - Array of elements
        Throws:
        java.lang.Exception - Store error occurred
      • printIndent

        public void printIndent​(java.io.PrintWriter aWriter,
                                int indent)
        Print some spaces.
        Parameters:
        aWriter - The output writer
        indent - The number of spaces
      • printAttributes

        public void printAttributes​(java.io.PrintWriter writer,
                                    int indent,
                                    java.lang.Object bean,
                                    StoreDescription desc)
                             throws java.lang.Exception
        Store the relevant attributes of the specified JavaBean, plus a className attribute defining the fully qualified Java class name of the bean.
        Parameters:
        writer - PrintWriter to which we are storing
        indent - Indentation level
        bean - Bean whose properties are to be rendered as attributes,
        desc - Store description of the current element
        Throws:
        java.lang.Exception - if an exception occurs while storing
      • printAttributes

        public void printAttributes​(java.io.PrintWriter writer,
                                    int indent,
                                    boolean include,
                                    java.lang.Object bean,
                                    StoreDescription desc)
                             throws java.lang.Exception
        Store the relevant attributes of the specified JavaBean.
        Parameters:
        writer - PrintWriter to which we are storing
        indent - Indentation level
        include - Should we include a className attribute?
        bean - Bean whose properties are to be rendered as attributes,
        desc - RegistryDescriptor from this bean
        Throws:
        java.lang.Exception - if an exception occurs while storing
      • checkAttribute

        protected java.lang.Object checkAttribute​(StoreDescription desc,
                                                  java.beans.PropertyDescriptor descriptor,
                                                  java.lang.String attributeName,
                                                  java.lang.Object bean,
                                                  java.lang.Object bean2)
        Check if the attribute should be printed.
        Parameters:
        desc - RegistryDescriptor from this bean
        descriptor - PropertyDescriptor from this bean property
        attributeName - The attribute name to store
        bean - The current bean
        bean2 - A default instance of the bean for comparison
        Returns:
        null if the value should be skipped, the value to print otherwise
      • printAttribute

        protected void printAttribute​(java.io.PrintWriter writer,
                                      int indent,
                                      java.lang.Object bean,
                                      StoreDescription desc,
                                      java.lang.String attributeName,
                                      java.lang.Object bean2,
                                      java.lang.Object value)
        Store the specified of the specified JavaBean.
        Parameters:
        writer - PrintWriter to which we are storing
        indent - Indentation level
        bean - The current bean
        desc - RegistryDescriptor from this bean
        attributeName - The attribute name to store
        bean2 - A default instance of the bean for comparison
        value - The attribute value
      • isPrintValue

        public boolean isPrintValue​(java.lang.Object bean,
                                    java.lang.Object bean2,
                                    java.lang.String attrName,
                                    StoreDescription desc)
        Determine if the attribute value needs to be stored.
        Parameters:
        bean - original bean
        bean2 - default bean
        attrName - attribute name
        desc - StoreDescription from bean
        Returns:
        true if the value should be stored
      • defaultInstance

        public java.lang.Object defaultInstance​(java.lang.Object bean)
                                         throws java.lang.ReflectiveOperationException
        Generate default Instance for the specified bean.
        Parameters:
        bean - The bean
        Returns:
        an object from same class as bean parameter
        Throws:
        java.lang.ReflectiveOperationException - Error creating a new instance
      • printValue

        public void printValue​(java.io.PrintWriter writer,
                               int indent,
                               java.lang.String name,
                               java.lang.Object value)
        Print an attribute value.
        Parameters:
        writer - PrintWriter to which we are storing
        indent - Indentation level
        name - Attribute name
        value - Attribute value
      • isPersistable

        protected boolean isPersistable​(java.lang.Class<?> clazz)
        Is the specified property type one for which we should generate a persistence attribute?
        Parameters:
        clazz - Java class to be tested
        Returns:
        true if the specified class should be stored