org.peaseplate.lang
Interface Designator

All Known Implementing Classes:
CallDesignator, CommentDesignator, CompileDirectiveDesignator, ContentDesignator, ElseDesignator, ElseIfDesignator, EndDesignator, IfDesignator, ImportDesignator, IncludeDesignator, LineSeparatorDesignator, MacroDesignator, MessageDesignator, PrintDesignator, WhileDesignator, WithDesignator, WithEachDesignator

public interface Designator

A designator knows how to compile a code fragment enclosed by the "${" and "}". It has a keyword which identifies this designator. Default designators are (among others): "print", "if", "while", "end", "import", "include",...

Author:
Manfred HANTSCHEL

Method Summary
 Chunk compile(TemplateEngine engine, CompileContext context, Token token)
           
 java.lang.String getKeyword()
          Returns the keyword of the designator.
 boolean isBlockExpansion()
           
 boolean isBlockHead()
           
 boolean isBlockTail()
           
 boolean isEmpty()
          If this method returns true it indicates that the code fragment does not contain code and does not need to get compiled (e.g.
 boolean isExpandableBlock()
           
 boolean isVisible()
          Returns true if the chunk generated by the designator is visible, false otherwise.
 

Method Detail

getKeyword

java.lang.String getKeyword()
Returns the keyword of the designator. The keyword must be unique within the TemplateEngine. The following characters are allowed: any letter, any digit, '.', '_', '-' and '/'.

Returns:
the keyword of the designator, not null

isEmpty

boolean isEmpty()
If this method returns true it indicates that the code fragment does not contain code and does not need to get compiled (e.g. ${end}, ${else}, ${break},...).

Returns:
true if empty, false otherwise

isVisible

boolean isVisible()
Returns true if the chunk generated by the designator is visible, false otherwise. If the chunk can generate visible output, this method returns true. A content chunk with only white spaces in it, is by definition not visible. This method cannot compute this, since is does not get the source. Handle ContentDesignator separately.

Returns:
true if visible, false otherwise

isBlockHead

boolean isBlockHead()

isBlockTail

boolean isBlockTail()

isExpandableBlock

boolean isExpandableBlock()

isBlockExpansion

boolean isBlockExpansion()

compile

Chunk compile(TemplateEngine engine,
              CompileContext context,
              Token token)
              throws TemplateException
Throws:
TemplateException


Copyright © 2008. All Rights Reserved.