CyLog Software Homepage BeanMaker v2.10
Copyright 2000-2006 CyLog Software
Introduction
Quick Guide
How the engine works
Writing Templates
   Standard Tags
   Property Loop Tags
   Switch Tags
   Include File Tag
   Regular Expression Tag
   String Function Tags
   Numeric Function Tags
   
Tutorials
Registration
License Agreement

Writing Templates - Standard Tags

BeanMaker's Standard Tags are listed below. These tags are defined in the Project configuration, as part of the Bean Type definition, or as part of the Class setup.

$package$The name of the package
$class$The name of the class (eg, "BeanMaker")
$version$Version number of the class
$date$Creation date
$author$Author's name
$company$Company/Organisation
$project_name$The name of the project from the project descriptor
$src_path$Source path from the project configuration
$template_path$Template path from the project configuration
$execution_path$Path where BeanMaker started from
 
Property Loop
To add property values (types, names, etc.) you have to do a "property loop". Use the following code:
$doproperty[(a,b)]$start the loop (this line is removed)
    ......the body of the loop (indentation is kept)
$loop$end the loop (this line is removed)
You can also use the inline property loop ($ploop(a,b,'...','...')$), a tag that generates a one-line string based on property values. For more information on Property Loops read the Property Loop Tags page
 
Property tags
Loops are executed exactly once for each property of the bean. Inside the loop use the following tags to dynamically insert property values:
$index$The sequence number of the property, starting from 0
$count$The sequence number of the property, starting from 1
$pre$Hungarian variable prefix for the property(eg, "b" for booleans)
$propertytype$The type of the property, i.e. the first string token of a line in the Properties box
$property$The property name as written in the Properties box (the 2nd token)
$Property$The property name having the first character capitalised
$fieldname$The database field name as written in the Properties box (3rd token - optional).
$fieldtype$The database field type (4th token)
$fieldisnull$Results to true or false depending on whether the database field NULLability value is set to nothing or NOT_NULL respectively (5th token - optional)
Additionally, the following tags can be used in order to produce aligned text output by padding strings with spaces at the end:
$propertytype_rpad$The type of the property right-padded with spaces to the maximum length of any property type
$property_rpad$The property name as written in the Properties box. (eg, "firstName"), right-padded with spaces to the maximum length of any property type
$Property_rpad$The property name having the first character capitalised (eg, "FirstName"), right-padded with spaces to the maximum length of any property type
$fieldname_rpad$The database field name, right-padded with spaces to the maximum length of any field name
$fieldtype_rpad$The database field type, right-padded with spaces to the maximum length of any field type
You can also access the maximum length of property names and property types by using the following tags:
$maxproplen$The maximum length (in chars) of property names used in a bean
$maxtypelen$The maximum length (in chars) of property types used in a bean
$maxfieldlen$The maximum length (in chars) of field names used in a bean
$maxfieldtypelen$The maximum length (in chars) of field types used in a bean
 
Property Array tags
Most of the above tags can be used as arrays to get an indexed property attribute. The property index runs from 0 to $propertycount$-1. The following tags can be used as arrays:
$propertytype[n]$$property[n]$$Property[n]$
$propertytype_rpad[n]$$property_rpad[n]$$Property_rpad[n]$
$fieldname[n]$$fieldtype[n]$$fieldisnull[n]$
$fieldname_rpad[n]$$fieldtype_rpad[n]$$pre[n]$
 
Argument & Member variable prefixes
Hungarian notation is sometimes used to denote arguments and member variables. The following tags although they can be used anywhere in the template, they are normally used inside a property loop:
$arg$prefix of method arguments (eg, a_)
$var$prefix of member variables (eg, m_)
 
Constants
The BeanMaker engine also defines two constants which are particularly useful in loops and functions, although they can be used anywhere in the template:
%EOL%Inserts an End-Of-Line marker (CR,LF)
%BACKSPACE%Inserts a backspace, i.e. deletes the character before it
/*
 * Example of using standard tags on a file header
 *
 * Copyright 2005 CyLog All Rights Reserved.
 *
 * Package: $package$
 * Class:   $class$.java
 */
package $package$;
Copyright 2000-2006 CyLog Software    www.cylog.org