Package relaxngcc.codedom

# Class CDFormatter

java.lang.Object
relaxngcc.codedom.CDFormatter

Direct Known Subclasses:
  `CDJavaFormatter`

public abstract class CDFormatter extends 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

Constructors
Constructor
Description
`CDFormatter(Writer writer)`

## Method Summary

Modifier and Type
Method
Description
`final 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(String token)`
Outputs a new token.
`CDFormatter`
`state(CDStatement s)`
Prints a statement.
`final 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 Details

### CDFormatter

public CDFormatter(Writer writer)

## Method Details

### in

public CDFormatter in()
Indent.

### out

public CDFormatter out()
Unindent.

### nl

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

Returns:
  "this."
Throws:
  `IOException`

### p

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

Returns:
  "this"
Throws:
  `IOException`

### p

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

Returns:
  "this."
Throws:
  `IOException`

### express

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

Throws:
  `IOException`

### state

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

Throws:
  `IOException`

### type

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

Throws:
  `IOException`

### declare

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

Throws:
  `IOException`

### write

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

Throws:
  `IOException`

### eos

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

Throws:
  `IOException`