org.peaseplate.internal.designator
Class IfDesignator

java.lang.Object
  extended by org.peaseplate.internal.designator.IfDesignator
All Implemented Interfaces:
Designator

public class IfDesignator
extends java.lang.Object
implements Designator

The designator for the "if" keyword. Expects the code chunk to contain a expression that can be evaluated to either true or false. This designator starts a block that may be followed by an "else" or "else-if" block.

Author:
Manfred HANTSCHEL

Field Summary
static java.lang.String NAME
           
 
Constructor Summary
IfDesignator()
           
 
Method Summary
 Chunk compile(TemplateEngine engine, CompileContext context, Token token)
           
 java.lang.String getKeyword()
          The keyword of this designator is "if".
 boolean isBlockExpansion()
           
 boolean isBlockHead()
           
 boolean isBlockTail()
           
 boolean isEmpty()
          The designator is not empty.
 boolean isExpandableBlock()
           
 boolean isVisible()
          Returns true if the chunk generated by the designator is visible, false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values
Constructor Detail

IfDesignator

public IfDesignator()
Method Detail

getKeyword

public java.lang.String getKeyword()
The keyword of this designator is "if".

Specified by:
getKeyword in interface Designator
Returns:
the keyword of the designator, not null
See Also:
Designator.getKeyword()

isEmpty

public boolean isEmpty()
The designator is not empty.

Specified by:
isEmpty in interface Designator
Returns:
true if empty, false otherwise
See Also:
Designator.isEmpty()

isBlockHead

public boolean isBlockHead()
Specified by:
isBlockHead in interface Designator
See Also:
Designator.isBlockHead()

isBlockTail

public boolean isBlockTail()
Specified by:
isBlockTail in interface Designator
See Also:
Designator.isBlockTail()

isExpandableBlock

public boolean isExpandableBlock()
Specified by:
isExpandableBlock in interface Designator
See Also:
Designator.isExpandableBlock()

isBlockExpansion

public boolean isBlockExpansion()
Specified by:
isBlockExpansion in interface Designator
See Also:
Designator.isBlockExpansion()

isVisible

public boolean isVisible()
Description copied from interface: Designator
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.

Specified by:
isVisible in interface Designator
Returns:
true if visible, false otherwise
See Also:
Designator.isVisible()

compile

public Chunk compile(TemplateEngine engine,
                     CompileContext context,
                     Token token)
              throws TemplateException
Specified by:
compile in interface Designator
Throws:
TemplateException
See Also:
Designator.compile(org.peaseplate.TemplateEngine, org.peaseplate.internal.model.CompileContext, org.peaseplate.internal.parser.Token)


Copyright © 2008. All Rights Reserved.