Class MessageFormatFilter
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.filter.MessageFormatFilter
-
- All Implemented Interfaces:
Serializable
,Cloneable
,DataSource
public class MessageFormatFilter extends Object implements DataSource
A filter that formats values from a data source to a string representation. This filter will format objects using aMessageFormat
to create the string representation for the number obtained from the datasource.- Author:
- Joerg Schaible, Thomas Morgner
- See Also:
MessageFormat
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MessageFormatFilter()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MessageFormatFilter
clone()
Clones thisDataSource
.String
getFormatString()
Returns the format string used in the message format.String
getNullString()
Returns the replacement text if one of the referenced fields in the message is null.Object
getValue(ExpressionRuntime runtime, ReportElement element)
Returns the formatted string.void
setFormatString(String format)
Defines the format string for theMessageFormat
object used in this implementation.void
setNullString(String nullString)
Defines the replacement text that is used, if one of the referenced fields in the message is null.
-
-
-
Method Detail
-
setFormatString
public void setFormatString(String format)
Defines the format string for theMessageFormat
object used in this implementation.- Parameters:
format
- the message format.
-
getFormatString
public String getFormatString()
Returns the format string used in the message format.- Returns:
- the format string.
-
getValue
public Object getValue(ExpressionRuntime runtime, ReportElement element)
Returns the formatted string. The value is read using the data source given and formated using the formatter of this object. The formating is guaranteed to completly form the object to an string or to return the defined NullValue. If format, datasource or object are null, the NullValue is returned.- Specified by:
getValue
in interfaceDataSource
- Parameters:
runtime
- the expression runtime that is used to evaluate formulas and expressions when computing the value of this filter.element
-- Returns:
- The formatted value.
-
clone
public MessageFormatFilter clone() throws CloneNotSupportedException
Clones thisDataSource
.- Specified by:
clone
in interfaceDataSource
- Overrides:
clone
in classObject
- Returns:
- the clone.
- Throws:
CloneNotSupportedException
- this should never happen.
-
getNullString
public String getNullString()
Returns the replacement text if one of the referenced fields in the message is null.- Returns:
- the replacement string for null-values.
-
setNullString
public void setNullString(String nullString)
Defines the replacement text that is used, if one of the referenced fields in the message is null.- Parameters:
nullString
- the replacement string for null-values.
-
-