relaxngcc.codedom
Class CDFormatter

java.lang.Object
  extended by relaxngcc.codedom.CDFormatter
Direct Known Subclasses:
CDJavaFormatter

public abstract class CDFormatter
extends java.lang.Object

Formats a code DOM and produces a source code. This object controls the formatting (such as indentation) and handles language-specific construct.

Author:
Kohsuke Kawaguchi (kk@kohsuke.org)

Constructor Summary
CDFormatter(java.io.Writer writer)
           
 
Method Summary
 CDFormatter declare(CDVariable v)
          Outputs VariableDeclaration as a declaration.
 CDFormatter eos()
          Marks the end of a statement.
 CDFormatter express(CDExpression exp)
          Prints expression.
 CDFormatter in()
          Indent.
 CDFormatter nl()
          Clears the current line and this method also prints indentation.
 CDFormatter out()
          Unindent.
 CDFormatter p(char ch)
          Outputs a new token.
 CDFormatter p(java.lang.String token)
          Outputs a new token.
 CDFormatter state(CDStatement s)
          Prints a statement.
 CDFormatter type(CDType t)
          Outputs a type object.
abstract  CDFormatter write(CDLanguageSpecificString str)
          Outputs a language specific string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CDFormatter

public CDFormatter(java.io.Writer writer)
Method Detail

in

public CDFormatter in()
Indent.


out

public CDFormatter out()
Unindent.


nl

public CDFormatter nl()
               throws java.io.IOException
Clears the current line and this method also prints indentation.

Returns:
"this."
Throws:
java.io.IOException

p

public CDFormatter p(java.lang.String token)
              throws java.io.IOException
Outputs a new token. Sooner or later all the methods come down to this method for output.

Returns:
"this"
Throws:
java.io.IOException

p

public CDFormatter p(char ch)
              throws java.io.IOException
Outputs a new token.

Returns:
"this."
Throws:
java.io.IOException

express

public CDFormatter express(CDExpression exp)
                    throws java.io.IOException
Prints expression.

Throws:
java.io.IOException

state

public CDFormatter state(CDStatement s)
                  throws java.io.IOException
Prints a statement.

Throws:
java.io.IOException

type

public final CDFormatter type(CDType t)
                       throws java.io.IOException
Outputs a type object.

Throws:
java.io.IOException

declare

public final CDFormatter declare(CDVariable v)
                          throws java.io.IOException
Outputs VariableDeclaration as a declaration.

Throws:
java.io.IOException

write

public abstract CDFormatter write(CDLanguageSpecificString str)
                           throws java.io.IOException
Outputs a language specific string.

Throws:
java.io.IOException

eos

public CDFormatter eos()
                throws java.io.IOException
Marks the end of a statement.

Throws:
java.io.IOException