JALOPY | Java Source Code Formatter Beautifier Pretty Printer
Overview • Download • Documentation • Plug-ins • Links • Contact
Features | History | Manual | FAQ | Javadoc
This page generated: June 8 2004
4.3.8. Environment
Prev | 4.3. Printer | Next
### 4.3.8. Environment Lets you specify/view environment variables. Environment variables can be used in headers, footers and Javadoc templates to form variable expressions that will be resolved during printing. I call this process variable interpolation. Environment variables are simple key/value pairs. Valid keys take the form `([a-zA-Z_][a-zA-Z0-9_.])+` and are case-sensitive. Values can be freely choosen. Example 4.142. Sample environment variables author = <a href="http://jalopy.sf.net/contact.html">Marco Hunsicker</a> project = Jalopy Java Source Code Formatter #### 4.3.8.1. User environment variables Lets you specify you're user specific environment variables. Use the Add... and Remove buttons to add or remove items to and from the list. #### 4.3.8.2. System environment variables All system environment variables are automatically available as well but cannot be changed from within Jalopy. #### 4.3.8.3. Local environment variables Additionaly, Jalopy provides some local variables that are automatically set depending on the execution context. The current list of valid local variables reads as follows: Table 4.1. Local environment variables
file | The absolute path of the currently processed Java file (e.g. `/usr/projects/test/MyFile.java`)
fileName | The name of the currently processed Java file (e.g. `MyFile.java`)
fileFormat | A string represention of the file format that will be used to write a file (e.g. UNIX or DOS)
package | The package name of the currently processed Java file (e.g. com.foo.mypackage)
convention | The name of the currently active code convention (as specified in the settings)
tabSize | The current indentation setting (as specified in the settings)
objectType | Only applies to Javadoc templates: Holds the type name of the class for a constructor.
paramType | Only applies to Javadoc templates: Holds the type name of a parameter.
exceptionType | Only applies to Javadoc templates: Holds the type name of a throws clause.
#### 4.3.8.4. Usage Once defined, variables can then be enclosed with the dollar sign to form variable expressions. Variable expressions thus take the form `$([a-zA-Z_][a-zA-Z0-9_.]+)$`. During printing these expressions will be interpolated and the value of the variable inserted into the output file. Example 4.143. Header template with environment variable expressions
    //==============================================================================
    // file :       $fileName$
    // project:     $project$
    //
    // last change: date:       $Date$
    //              by:         $Author$
    //              revision:   $Revision$
    //------------------------------------------------------------------------------
    // copyright:   BSJT Software License (see class documentation)
    //==============================================================================
Example 4.144. Header after interpolation
    //==============================================================================
    // file :       Byte.java
    // project:     bsjt-rt
    //
    // last change: date:       $Date$
    //              by:         $Author$
    //              revision:   $Revision$
    //------------------------------------------------------------------------------
    // copyright:   BSJT Software License (see class documentation)
    //==============================================================================
As you see with the above example, if a variable is not defined, Jalopy won't touch the expression and simply preserve the original content. This way Jalopy works nicely with other source code tools and SCM products.
Prev | Up | Next
4.3.7. Imports | Home | 4.3.9. Javadoc
to top