terp grants you access to (virtually) any public field and function declared by a Java object. Clearly, this means that if you have any security concerns at all, you need to expand terp templates with a security manager and/or a security policy that protects the assets you care about. terp is no different from any other Java program in this regard.

terp uses reflection to find eligible fields and methods. The resolution process attempts to identify fields and methods that match the name and arguments that are being used in your terp template. The name resolution process is case insensitive; toUppercase() and tOuPpeRcAsE() are absolutely equivalent method invocations.

Case insensitivity causes a potential problem: when methods differ only in case, terp might not be able to distinguish one method from another. In such a case terp will pick the first method it finds that satisfies argument type constraints.

See the following examples.

C:\terp\bin>terp -e 3.toString()+4
C:\terp\bin>terp -e 3.4.longvalue()
C:\terp\bin>terp -e \"alex\".touppercase()

terp allows you to extend a type by additional fields or functions. For example, we have extended collection and string types by a size and length field. Objects of type have been extended by lines and text fields that give you access to the contents of a file in various formats.

Ordered collection types also have first and last fields, as well as numeric index fields, i.e. you can use a numeric index like a property name.

C:\terp\bin>terp -e "{1,2,3}.first"
C:\terp\bin>terp -e "{1.2.3}.last"
C:\terp\bin>terp -e {1,2,3}.0



Copyright 2006-2016 by Codemesh, Inc., ALL RIGHTS RESERVED

terp expressions home expressions templates ant about us contact us download