|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.brains2b.typewriter.ContentTemplate
org.brains2b.typewriter.IfTemplate
Template for creating conditions and else statements in another ContentTemplate
ContentTemplate.createIf(String)
Field Summary |
Fields inherited from class org.brains2b.typewriter.ContentTemplate |
m_content |
Constructor Summary | |
IfTemplate(java.lang.String condition)
Constructor for IfTemplate. |
Method Summary | |
BlockTemplate |
createElse()
create an else statement for this condition |
java.lang.String |
getCondition()
get the condition. |
void |
setCondition(java.lang.String condition)
set the expression to evaluate for this condition |
void |
write(java.io.PrintWriter writer,
int indent)
this implementation of write follows the rule that if this statement has an else statement which only contains another if statement the statement should read } else if (
instead of closing the else and starting with a new condition. |
void |
write(java.io.PrintWriter writer,
int indent,
boolean firstLine)
write the if statement to the PrintWriter |
Methods inherited from class org.brains2b.typewriter.ContentTemplate |
addImport, addText, createFor, createIf, createTry, createWhile, getContent, getParent, makeInstance, makeInstance, makeInstance, setContent, setParent |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public IfTemplate(java.lang.String condition)
condition
- String, an expression defining the condition for this statementMethod Detail |
public void write(java.io.PrintWriter writer, int indent)
this implementation of write follows the rule that if
this statement has an else statement which only contains
another if statement the statement should read } else if (
instead of closing the else and starting with a new condition.
write
in interface Template
write
in class ContentTemplate
Template.write(java.io.PrintWriter, int)
public void write(java.io.PrintWriter writer, int indent, boolean firstLine)
writer
- PrintWriterindent
- int, current indentfirstLine
- boolean, false if this is a condition which is the only
content of an else branch, true if it is a regular condition
TypeWriterException,
- if the condition is not set or if it is emptyTemplate.write(java.io.PrintWriter, int)
public BlockTemplate createElse()
public void setCondition(java.lang.String condition)
condition
- String, the expressionpublic java.lang.String getCondition()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |