de.hunsicker.jalopy.printer
Class AnnotationDefPrinter

java.lang.Object
  |
  +--de.hunsicker.jalopy.printer.AbstractPrinter
        |
        +--de.hunsicker.jalopy.printer.AnnotationDefPrinter
All Implemented Interfaces:
Printer

public class AnnotationDefPrinter
extends de.hunsicker.jalopy.printer.AbstractPrinter

This class prints out an annotation group The format may be similar to

  public @interface License
   {
      String name();

      String notice(); 

      boolean redistributable();

     Trademark[] trademarks();

  }
  

Since:
1.5
Version:
$ $
Author:
NotZippy

Field Summary
protected static Convention settings
          The code convention settings.
 
Constructor Summary
protected AnnotationDefPrinter()
          Single instance
 
Method Summary
protected  int countChildrenLines(JavaNode n, int current)
          Counts the number of blank lines following a node
static Printer getInstance()
          Returns the sole instance of this class.
protected  void prepareComment(JavaNode lcurly, JavaNode rcurly, NodeWriter out)
           
 void print(antlr.collections.AST node, NodeWriter out)
          Adds a marker
 void printChildren(antlr.collections.AST node, NodeWriter out)
          Prints all the children of the passed node
protected  void printIndentation(int diff, NodeWriter out)
          Outputs indentation whitespace according to the current marker offset.
protected  void printIndentation(de.hunsicker.jalopy.printer.Marker marker, NodeWriter out)
          Outputs indentation whitespace.
protected  void printIndentation(NodeWriter out)
          Outputs indentation whitespace according to the current marker offset or indentation level (depends on the used indentation policy).
 void trackPosition(JavaNode node, int line, int column, NodeWriter out)
          Tracks the position of the given node by updating the position information.
 void trackPosition(JavaNode node, NodeWriter out)
          Tracks the position of the given node by updating the position information
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

settings

protected static final Convention settings
The code convention settings.

Constructor Detail

AnnotationDefPrinter

protected AnnotationDefPrinter()
Single instance

Method Detail

getInstance

public static final Printer getInstance()
Returns the sole instance of this class.

Returns:
the sole instance of this class.

print

public void print(antlr.collections.AST node,
                  NodeWriter out)
           throws java.io.IOException
Adds a marker

Specified by:
print in interface Printer
Specified by:
print in class de.hunsicker.jalopy.printer.AbstractPrinter
Parameters:
node -
out -
Throws:
java.io.IOException

printChildren

public final void printChildren(antlr.collections.AST node,
                                NodeWriter out)
                         throws java.io.IOException
Prints all the children of the passed node

java.io.IOException

trackPosition

public void trackPosition(JavaNode node,
                          NodeWriter out)
Tracks the position of the given node by updating the position information

Parameters:
node - the node that needs its position tracked.
out - stream to write to.
Since:
1.0b9

trackPosition

public void trackPosition(JavaNode node,
                          int line,
                          int column,
                          NodeWriter out)
Tracks the position of the given node by updating the position information.

Parameters:
node - the node that needs its position tracked.
line - the new line position.
column - the new column position.
out - stream to write to.
Since:
1.0b9

printIndentation

protected void printIndentation(NodeWriter out)
                         throws java.io.IOException
Outputs indentation whitespace according to the current marker offset or indentation level (depends on the used indentation policy).

Parameters:
out - stream to write to.
Throws:
java.io.IOException - if an I/O error occured.
Since:
1.0b8

printIndentation

protected void printIndentation(de.hunsicker.jalopy.printer.Marker marker,
                                NodeWriter out)
                         throws java.io.IOException
Outputs indentation whitespace.

Parameters:
marker - if not null this marker will be used to calculate the right amount of indentation whitespace. Otherwise indentation depends on the general indentation policy.
out - stream to write to.
Throws:
java.io.IOException - if an I/O error occured.
Since:
1.0b9

printIndentation

protected void printIndentation(int diff,
                                NodeWriter out)
                         throws java.io.IOException
Outputs indentation whitespace according to the current marker offset. If no marker is set, this method does nothing.

Parameters:
diff - The amount
out - stream to write to.
Throws:
java.io.IOException - if an I/O error occured.
Since:
1.0b8

prepareComment

protected void prepareComment(JavaNode lcurly,
                              JavaNode rcurly,
                              NodeWriter out)

countChildrenLines

protected int countChildrenLines(JavaNode n,
                                 int current)
Counts the number of blank lines following a node

Parameters:
n - The node
Returns:
The number of lines


Copyright © 1997-2005 Jalopy. All Rights Reserved.