Interface XMLElementReader<C>

Type Parameters:
C - the reader context type
All Superinterfaces:
XMLComponentReader<C>, org.jboss.staxmapper.XMLElementReader<C>
All Known Implementing Classes:
ResourceXMLContainer.ResourceAttributesXMLContentReader, ResourceXMLContainer.ResourceXMLContainerReader

public interface XMLElementReader<C> extends org.jboss.staxmapper.XMLElementReader<C>, XMLComponentReader<C>
Adds absentee element handling to an {link org.jboss.staxmapper.XMLElementReader}.
Author:
Paul Ferraro
  • Method Summary

    Modifier and Type
    Method
    Description
    default <T> XMLElementReader<T>
    map(Function<T,C> mapper)
    Returns a new reader whose context is mapped from the specified function.
    static <C> XMLElementReader<C>
    validate(QName expected, XMLElementReader<C> elementReader)
    Decorates an XMLElementReader with entry/exit criteria validation.
    default void
    whenAbsent(C context)
    Triggered when the associated XML content is absent from the XML input.
    default <T> XMLElementReader<T>
    withContext(Supplier<C> contextFactory, BiConsumer<T,C> applicator)
    Returns a new reader whose context is generated from the specified factory and applied via the specified consumer.

    Methods inherited from interface org.jboss.staxmapper.XMLElementReader

    readElement
  • Method Details

    • whenAbsent

      default void whenAbsent(C context)
      Description copied from interface: XMLComponentReader
      Triggered when the associated XML content is absent from the XML input.
      Specified by:
      whenAbsent in interface XMLComponentReader<C>
      Parameters:
      context - a reader context
    • map

      default <T> XMLElementReader<T> map(Function<T,C> mapper)
      Returns a new reader whose context is mapped from the specified function.
      Type Parameters:
      T - the mapped context type
      Parameters:
      mapper - a context mapping function
      Returns:
      a new writer whose context is mapped from the specified function.
    • withContext

      default <T> XMLElementReader<T> withContext(Supplier<C> contextFactory, BiConsumer<T,C> applicator)
      Returns a new reader whose context is generated from the specified factory and applied via the specified consumer.
      Type Parameters:
      T - the mapped context type
      Parameters:
      contextFactory - supplier of the read context
      applicator - application of the read context
      Returns:
      a new writer whose context is generated from the specified factory and applied via the specified consumer.
    • validate

      static <C> XMLElementReader<C> validate(QName expected, XMLElementReader<C> elementReader)
      Decorates an XMLElementReader with entry/exit criteria validation.
      Type Parameters:
      C - the read context
      Parameters:
      name - the name of the expected element
      elementReader - the reader of an element
      Returns:
      a validating reader