Package org.takes.rs.xe
Class XeTransform<T>
- java.lang.Object
-
- org.takes.rs.xe.XeTransform<T>
-
- Type Parameters:
T
- Type of item
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
XeTransform.Func<T>
Function to map them.
-
Constructor Summary
Constructors Constructor Description XeTransform(Iterable<T> list, XeTransform.Func<T> fnc)
Ctor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterator<XeSource>
iterator()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-