Package com.googlecode.jatl
Interface MarkupWriter
- All Known Subinterfaces:
MarkupBuilderWriter
- All Known Implementing Classes:
HtmlWriter
public interface MarkupWriter
Wrap builders for deferred writing.
This is useful when you want to define the markup but do not
have the Writer
yet.
Often this is the case when:
- MVC framework (such as Spring MVC) where the writer is not available till rendering time.
- Composition of builders.
MarkupWriter
s.
private HtmlWriter createInput(final String name, final String value) { return new HtmlWriter() { protected void build() { input().name(name).value(value).end(); } }; } private HtmlWriter createForm(final HtmlWriter ... inputs) { return new HtmlWriter() { protected void build() { form().write(inputs).end(); } }; }See
MarkupBuilder.write(MarkupWriter...)
-
Method Summary
-
Method Details
-
write
Writes using the given writer. The writer should not be closed and will not be closed by implementations. Its up to the caller to close the writer.- Type Parameters:
W
- writer type.- Parameters:
writer
- not null.- Returns:
- the writer used for fluent style.
-