Usage

Once defined, variables can then be enclosed with dollar signs to form variable expressions. Variable expressions thus take the form $[a-zA-Z_][a-zA-Z0-9_.\\-]*$.

Example 2.4. Sample variable expressions

$author$
$projectr$

During printing these expressions will be interpolated and the value of the variable inserted into the output file.

Example 2.5. Header template with environment variable expressions

//===============================================================
// file :       $file.name$
// project:     $project$
//
// last change: date:       $Date$
//              by:         $author$
//              revision:   $Revision$
//---------------------------------------------------------------
// copyright:   BSJT Software License (see class documentation)
//===============================================================

Example 2.6. Header after interpolation

//===============================================================
// file :       Byte.java
// project:     bsjt-rt
//
// last change: date:       $Date$
//              by:         John Doo
//              revision:   $Revision$
//---------------------------------------------------------------
// copyright:   BSJT Software License (see class documentation)
//===============================================================

As you can see in the above example, if a variable is not defined, Jalopy won't touch the expression and simply preserves the original content. This way, the formatter works nicely with other source code tools and SCM products.

The available user and local environment variables are provided from within the context menu of the text component when customizing the different templates.

Figure 2.23. Insert variables via context menu

Insert variables via context menu

Please see the section called "Custom variables", the section called "System variables" and the section called "Local variables" for a description of the different available variable types.