org.peaseplate.chunk
Interface Chunk

All Known Subinterfaces:
BlockExpansion, BlockHead, BlockTail, ExpandableBlock
All Known Implementing Classes:
AbstractBlock, AbstractChunk, AbstractIfBlock, AbstractOutputChunk, CallChunk, ContentChunk, ElseBlock, ElseIfBlock, EndChunk, IfBlock, ImportChunk, IncludeChunk, LineSeparatorChunk, MacroBlock, MessageChunk, PrintChunk, VoidChunk, WhileBlock, WithBlock, WithEachBlock

public interface Chunk

A chunk is a piece of a compiled template.

Author:
Manfred HANTSCHEL

Method Summary
 int getColumn()
          Returns the column where this chunk is located in the source of the template.
 int getLine()
          Returns the line where this chunk is located in the source of the template.
 TemplateLocator getLocator()
          Returns the template locator of the template this chunk belongs to
 boolean isEssential()
          Returns true if the chunk is essential, false otherwise.
 boolean isVisible()
          Returns true if the chunk is visible, false otherwise.
 void render(BuildContext context, java.io.Writer writer)
          Renders the chunk to the specified writer using the specified template context.
 java.lang.String toString()
          Returns a meaningful representation of this chunk
 

Method Detail

getLocator

TemplateLocator getLocator()
Returns the template locator of the template this chunk belongs to

Returns:
the template locator

getLine

int getLine()
Returns the line where this chunk is located in the source of the template.

Returns:
the line

getColumn

int getColumn()
Returns the column where this chunk is located in the source of the template.

Returns:
the column

isVisible

boolean isVisible()
Returns true if the chunk is visible, false otherwise. A content chunk with only white spaces in it, is by definition not visible and not essential. It only gets essential if it's the only thing in the line.

Returns:
true if visible, false otherwise

isEssential

boolean isEssential()
Returns true if the chunk is essential, false otherwise. A code chunk is by default essential, a content chunk not if it contains just spaces.

Returns:
true if essential, false otherwise

render

void render(BuildContext context,
            java.io.Writer writer)
            throws TemplateException,
                   java.io.IOException
Renders the chunk to the specified writer using the specified template context.

Parameters:
context - the context
writer - the writer
Throws:
TemplateException - on occasion
java.io.IOException - on occasion

toString

java.lang.String toString()
Returns a meaningful representation of this chunk

Overrides:
toString in class java.lang.Object
Returns:
a meaningful representation of this chunk


Copyright © 2008. All Rights Reserved.