类 StaxEventItemReader<T>

    • 方法详细资料

      • setUnmarshaller

        public void setUnmarshaller​(org.springframework.oxm.Unmarshaller unmarshaller)
        参数:
        unmarshaller - maps xml fragments corresponding to records to objects
      • setFragmentRootElementName

        public void setFragmentRootElementName​(java.lang.String fragmentRootElementName)
        参数:
        fragmentRootElementName - name of the root element of the fragment
      • setFragmentRootElementNames

        public void setFragmentRootElementNames​(java.lang.String[] fragmentRootElementNames)
        参数:
        fragmentRootElementNames - list of the names of the root element of the fragment
      • setXmlInputFactory

        public void setXmlInputFactory​(javax.xml.stream.XMLInputFactory xmlInputFactory)
        Set the XMLInputFactory.
        参数:
        xmlInputFactory - to use
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        Ensure that all required dependencies for the ItemReader to run are provided after all properties have been set.
        指定者:
        afterPropertiesSet 在接口中 org.springframework.beans.factory.InitializingBean
        抛出:
        java.lang.IllegalArgumentException - if the Resource, FragmentDeserializer or FragmentRootElementName is null, or if the root element is empty.
        java.lang.IllegalStateException - if the Resource does not exist.
        java.lang.Exception
        另请参阅:
        InitializingBean.afterPropertiesSet()
      • moveCursorToNextFragment

        protected boolean moveCursorToNextFragment​(javax.xml.stream.XMLEventReader reader)
                                            throws NonTransientResourceException
        Responsible for moving the cursor before the StartElement of the fragment root. This implementation simply looks for the next corresponding element, it does not care about element nesting. You will need to override this method to correctly handle composite fragments.
        参数:
        reader - the XMLEventReader to be used to find next fragment.
        返回:
        true if next fragment was found, false otherwise.
        抛出:
        NonTransientResourceException - if the cursor could not be moved. This will be treated as fatal and subsequent calls to read will return null.
      • doRead

        protected T doRead()
                    throws java.io.IOException,
                           javax.xml.stream.XMLStreamException
        Move to next fragment and map it to item.
        指定者:
        doRead 在类中 AbstractItemCountingItemStreamItemReader<T>
        返回:
        an item or null if the data source is exhausted
        抛出:
        java.io.IOException
        javax.xml.stream.XMLStreamException