Jindent - Java Source Code Formatter http://www.jindent.com
 



title

5.4 Environment


title

5.4.1 Environment Variables


Jindent provides different kind of user defined templates which can be used to insert:
All these templates can contain 'environment variables'. Environment variables can be used to transfer informations from Jindent's environment to templates.
For example environment variable $declarationName$ which can be used in JavaDoc templates will be substituted by the name of the corresponding declaration (this can be a method name, class name, field name, and so on...).

Environment variables are either from type $variable$ or %variable%.

For instance a class declaration JavaDoc template which looks like:

/**                                     
 * $declarationName$, $declarationType$ 
 *                                      
 */                                     


would be inserted before a class declaration like:

/**                                     
 * MyClass, class                       
 *                                      
 */                                     
public class MyClass {                  
    ...                                 
}                                       


Whereas the %variable% syntax can be used to create JavaDocs in boxes:
For instance a class declaration template which looks like:

/*************************************  
 * %declarationName%                 *  
 *                                   *  
 *************************************/ 


would be inserted before a class declaration like:

/*************************************  
 * MyClass                           *  
 *                                   *  
 *************************************/ 
public class MyClass {                  
    ...                                 
}                                       

Substitution of %variable% does not change the alignment of all other template elements.
Whereas insertion of $variable$ inserts its substituted content fluently.


List of auto-generated environment variables which can be used in templates:

Variable name: Description: Accessible from template:
conventioNameName of used code conventionall
dateCurrent dateall
declarationNameName of declarationall JavaDocs
declarationTypeType of declarationall JavaDocs
exceptionNameName of exceptionmethod/constructor JavaDocs
fileFormatFile format (Dos, Unix, Mac)all
fileNameShort filename of current source fileall
fullFileNameFull filename of current source fileall
packageNamePackage name of current source fileall
paramNameName of parametermethod/constructor JavaDocs
paramTypeType of parametermethod/constructor JavaDocs
returnTypeMethod return typemethod JavaDocs
tabSizeSet output tab sizeall
textFormatSame as file format (Dos, Unix, Mac)all

Additionally environment variables can be user defined or contain informations from the system.


See also... See also: Jindent - Settings - Environment - Environment Variables - User Defined Variables , Jindent - Settings - Environment - Environment Variables - Special Variables , Jindent - Settings - Environment - Environment Variables - System Variables



title
5.4.1.1 Special Variables

Convention name

Convention name

Defines the name of used code convention. This environment variable can be accessed from all templates. Use $conventionName$ or %conventionName% to resolve it.



Date format

Date format

Defines a date format. This environment variable can be accessed from all templates. Use $date$ or %date% to resolve it.

Even if Jindent provides a list with date format presets it is possible to customize other date formats by hand.
The date format setting uses Java's JDK class java.text.SimpleDateFormat to format the current date. For details how to use its formatting patterns please refer to: java.text.SimpleDateFormat