Class XeTransform<T>

  • Type Parameters:
    T - Type of item
    All Implemented Interfaces:
    Iterable<XeSource>

    public final class XeTransform<T>
    extends Object
    implements Iterable<XeSource>
    Iterable to transform an iterable of some objects into an iterable of Xembly sources.

    Use this class to create a collection of XeSource objects and pass them to, for example, XeAppend:

     return new RsXembly(
       new XeAppend(
         "books",
         new XeTransform<Book>(
           this.database.books(),
           new XeTransform.Func<Book>() {
             @Override
             public XeSource transform(final Book book) {
               return new XeAppend(
                 "book",
                 new XeDirectives(
                   new Directives()
                     .add("book")
                     .attr("isbn", book.isbn());
                 )
               )
             }
           }
         )
       )
     );

    The class is immutable and thread-safe.

    Since:
    0.1