Interface XMLElementReader<C>

    • Method Detail

      • 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