org.jfree.report.function
Interface Expression

All Superinterfaces:
java.lang.Cloneable
All Known Subinterfaces:
Function
All Known Implementing Classes:
AbstractExpression, AbstractFunction

public interface Expression
extends java.lang.Cloneable

An expression is a lightweight function that does not maintain a state. Expressions are used to calculate values within a single row of a report. Expressions can use a dataRow to access other fields, expressions or functions within the current row in the report.

Author:
Thomas Morgner

Field Summary
static java.lang.String AUTOACTIVATE_PROPERTY
          Literal text for the 'autoactivate' property.
 
Method Summary
 java.lang.Object clone()
          Clones the expression, expression should be reinitialized after the cloning.
 DataRow getDataRow()
          Returns the DataRow used in this expression.
 int getDependencyLevel()
          The dependency level defines the level of execution for this function.
 Expression getInstance()
          Return a new instance of this expression.
 java.lang.String getName()
          Returns the name of the expression.
 java.util.Properties getProperties()
          Returns a copy of this Expression's properties.
 java.lang.Object getValue()
          Return the current expression value.
 void initialize()
          Checks that the expression has been correctly initialized.
 boolean isActive()
          Returns true if this expression contains autoactive content and should be called by the system, regardless whether this expression is referenced in the datarow.
 void setDataRow(DataRow theDataRow)
          Defines the DataRow used in this expression.
 void setDependencyLevel(int level)
          Sets the dependency level for the expression.
 void setName(java.lang.String name)
          Sets the name of the expression.
 void setProperties(java.util.Properties p)
          Set the expression properties.
 

Field Detail

AUTOACTIVATE_PROPERTY

public static final java.lang.String AUTOACTIVATE_PROPERTY
Literal text for the 'autoactivate' property.

See Also:
Constant Field Values
Method Detail

getName

public java.lang.String getName()
Returns the name of the expression.

Every expression, function and column in the datamodel within a report is required to have a unique name.

Returns:
the function name.

setName

public void setName(java.lang.String name)
Sets the name of the expression.

The name must not be null and must be unique within the expression group.

Parameters:
name - the name.

getValue

public java.lang.Object getValue()
Return the current expression value.

The value depends (obviously) on the expression implementation.

Returns:
the value of the function.

setProperties

public void setProperties(java.util.Properties p)
Set the expression properties.

expression parameters are recorded as properties.

Parameters:
p - the properties.

getProperties

public java.util.Properties getProperties()
Returns a copy of this Expression's properties.

Returns:
the properties for the expression.

isActive

public boolean isActive()
Returns true if this expression contains autoactive content and should be called by the system, regardless whether this expression is referenced in the datarow.

Returns:
true, if the expression is activated automaticly, false otherwise.

initialize

public void initialize()
                throws FunctionInitializeException
Checks that the expression has been correctly initialized. If there is a problem, this method throws a FunctionInitializeException.

Throws:
FunctionInitializeException - in case the expression is not initialized properly.

getDataRow

public DataRow getDataRow()
Returns the DataRow used in this expression. The dataRow is set when the report processing starts and can be used to access the values of functions, expressions and the reports datasource.

Returns:
the assigned DataRow for this report processing.

setDataRow

public void setDataRow(DataRow theDataRow)
Defines the DataRow used in this expression. The dataRow is set when the report processing starts and can be used to access the values of functions, expressions and the reports datasource.

Parameters:
theDataRow - the DataRow for this expression.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clones the expression, expression should be reinitialized after the cloning.

Expression maintain no state, cloning is done at the beginning of the report processing to disconnect the used expression from any other object space.

Returns:
A clone of this expression.
Throws:
java.lang.CloneNotSupportedException - this should never happen.

getDependencyLevel

public int getDependencyLevel()
The dependency level defines the level of execution for this function. Higher dependency functions are executed before lower dependency functions. For ordinary functions and expressions, the range for dependencies is defined to start from 0 (lowest dependency possible) to 2^31 (upper limit of int).

Levels below 0 are reserved for system-functionality (printing and layouting).

The level must not change during the report processing, or the result is invalid.

Returns:
the level.

setDependencyLevel

public void setDependencyLevel(int level)
Sets the dependency level for the expression.

Parameters:
level - the level.

getInstance

public Expression getInstance()
Return a new instance of this expression. The copy is initialized and uses the same parameters as the original, but does not share any objects.

Returns:
a copy of this function.