Usage

Once defined, variables can be enclosed with dollar signs to form variable expressions and embedded in comment templates. Variable expressions take the form $[a-zA-Z_][a-zA-Z0-9_.-]*$.

Example 2.6. Sample variable expressions

$author$
$project$

During emitting, these expressions will be interpolated and the value of the variable inserted into the source file.

Example 2.7. 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.8. 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.26. 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 descriptions of the different available variable types.