org.jfree.report.modules.misc.beanshell
public class: BSHExpression [javadoc |
source]
java.lang.Object
org.jfree.report.function.AbstractExpression
org.jfree.report.modules.misc.beanshell.BSHExpression
All Implemented Interfaces:
Expression, Serializable
An expression that uses the BeanShell scripting framework to perform a scripted
calculation. The expression itself is contained in a function called
Object getValue()
and this function is defined in the
expression property. You have to
overwrite the function
getValue() to begin and to end your expression, but
you are free to add your own functions to the script.
By default, base Java core and extension packages are imported for you. They are:
java.lang java.io java.util
java.net java.awt java.awt.event
javax.swing javax.swing.event
An example in the XML format: (from report1.xml)
// you may import packages and classes or use the fully qualified name of the class
import org.jfree.report.*;
String userdefinedFunction (String parameter, Date date)
{
return parameter + " - the current date is " + date);
}
// use simple java code to perform the expression. You may use all classes
// available in your classpath as if you write "real" java code in your favourite
// IDE.
// See the www.beanshell.org site for more information ...
//
// A return value of type "Object" is alway implied ...
getValue ()
{
return userdefinedFunction ("Hello World :) ", new Date());
}
| Field Summary |
|---|
| public static final String | BSHHEADERFILE | The headerfile with the default initialisations. |
| Methods from org.jfree.report.function.AbstractExpression: |
|---|
|
clone, getDataRow, getDependencyLevel, getInstance, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setActive, setDependencyLevel, setName, setPreserve, setRuntime |