Built-in Context

There are several built-in contexts in igpp.doc which provide access to useful class libraries. These context allow the use of the class methods in a template. For complete details of all available methods check the documentaiton for each class. The most useful and commonly used methods are:

Integer

Provides access to the java.lang.Integer class.

Some commonly used methods:

int Integer.parseInt(string)
Parses the string as an integer. Throws an exception if the string is not a valid integer value.
String toBinaryString(int i)
Returns a string representation of the integer argument as an unsigned integer in base 2.
String toHexString(int i)
Returns a string representation of the integer argument as an unsigned integer in base 16.
String toOctalString(int i)
Returns a string representation of the integer argument as an unsigned integer in base 8.

Long

Provides access to the java.lang.Long class.

Some commonly used methods:

int Long.parseLong(string)
Parses the string as an signed decimal long. Throws an exception if the string is not a valid long value.
String toBinaryString(long i)
Returns a string representation of the long argument as an unsigned integer in base 2.
String toHexString(int i)
Returns a string representation of the long argument as an unsigned integer in base 16.
String toOctalString(int i)
Returns a string representation of the long argument as an unsigned integer in base 8.

Double

Provides access to the java.lang.Double class.

Some commonly used methods:

double Double.parseDouble(string)
Parses the string as an double. Throws an exception if the string is not a valid double value.

String

Provides access to the java.lang.String class.

Some commonly used methods:

boolean startsWith(prefix)
Returns true if string starts with "prefix", false otherwise.
String toUpperCase()
Converts all of the characters in this String to upper case using the rules of the default locale.
String toLowerCase()
Converts all of the characters in this String to lower case using the rules of the default locale.
String trim()
Returns a copy of the string, with leading and trailing whitespace omitted.
String replaceAll(String regex, String replacement)
Replaces each substring of this string that matches the given regular expression with the given replacement.

Text

Convienence String operations from the igpp.util.Text class.

Some commonly used methods:

String toTitleCase(String s)
Convert a string to title case by capitalizing the first letter of each word.
String[] parseList(String s)
Parse a comma separated list into an array of Strings, trimming extra white space.

File

Provides access to the igpp.util.File class.

Some commonly used methods:

copy(String source, String destination)
Copy a file from one location to another.
rename(String source, String destination)
Rename a file.
String getName(String pathname)
Extract the name of the file from a pathname.
String getParent(String pathname)
Extract the parent of the file from a pathname.
String getBaseName(String pathname)
Extract the base name of the file from a pathname.
String getExtension(String pathname)
Extract the extension of the file from a pathname.
String concatPath(String path1, String path2, String separator)
Concatenate two paths ensuring that a file separator exists between each part.
long getSize(String pathname)
Return the size of the file in bytes.
String getMD5(String pathname)
Return the MD5 digest for a file.
String getSHA1(String pathname)
Return the SHA-1 digest for a file.
String getSHA256(String pathname)
Return the SHA-256 digest for a file.
String getSHA512(String pathname)
Return the SHA-512 digest for a file.

Date

Provides access to the igpp.util.Date class.

Some commonly used methods:

String now()
return the current data and time in the locale format.
String now("ISO")
return the current date and time in ISO-9601 format.

Calc

Provide access to the igpp.util.Calc class.

Some commonly used methods:

double perform(arg1, op, arg2)
Perform the mathematic operation (-, +, *, /) on arg1 and arg2, return the result.
double sum(list)
Sum the values in the list.
double ceil(value)
Round a value up to nearest integer and return value as a long.
double floor(value)
Round a value down to nearest integer and return value as a long.