net.percederberg.grammatica.code.java
Class JavaPackage

java.lang.Object
  |
  +--net.percederberg.grammatica.code.CodeElement
        |
        +--net.percederberg.grammatica.code.java.JavaPackage
All Implemented Interfaces:
java.lang.Comparable

public class JavaPackage
extends CodeElement

A class generating a Java package declaration.


Constructor Summary
JavaPackage(JavaPackage base, java.lang.String name)
          Creates a new Java package with the specified base package and name.
JavaPackage(java.lang.String name)
          Creates a new Java package with the specified name.
 
Method Summary
 int category()
          Returns a numeric category number for the code element.
 void print(java.io.PrintWriter out, CodeStyle style, int indent)
          Prints the code element to the specified output stream.
 java.io.File toFile(java.io.File baseDir)
          Returns the directory file containing the package files.
 java.lang.String toString()
          Returns a string representation of this package.
 
Methods inherited from class net.percederberg.grammatica.code.CodeElement
compareTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JavaPackage

public JavaPackage(java.lang.String name)
Creates a new Java package with the specified name.

Parameters:
name - the package name (including dots '.')

JavaPackage

public JavaPackage(JavaPackage base,
                   java.lang.String name)
Creates a new Java package with the specified base package and name.

Parameters:
base - the base package
name - the package name (including dots '.')
Method Detail

toString

public java.lang.String toString()
Returns a string representation of this package.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this package

category

public int category()
Returns a numeric category number for the code element. A lower category number implies that the code element should be placed before code elements with a higher category number within a declaration.

Specified by:
category in class CodeElement
Returns:
the category number

toFile

public java.io.File toFile(java.io.File baseDir)
Returns the directory file containing the package files.

Parameters:
baseDir - the base output directory
Returns:
the package directory

print

public void print(java.io.PrintWriter out,
                  CodeStyle style,
                  int indent)
Prints the code element to the specified output stream.

Specified by:
print in class CodeElement
Parameters:
out - the output stream
style - the code style to use
indent - the indentation level