Class StringFieldTemplate
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.filter.templates.AbstractTemplate
-
- org.pentaho.reporting.engine.classic.core.filter.templates.StringFieldTemplate
-
- All Implemented Interfaces:
Serializable
,Cloneable
,DataSource
,RawDataSource
,Template
public class StringFieldTemplate extends AbstractTemplate implements RawDataSource
A string field template.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description StringFieldTemplate()
Creates a new string field template.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringFieldTemplate
clone()
Clones the template.protected DataRowDataSource
getDataRowDataSource()
Returns the datarow data source used in this template.String
getField()
Returns the field name.FormatSpecification
getFormatString(ExpressionRuntime runtime, ReportElement element, FormatSpecification formatSpecification)
Returns information about the formatstring that was used to transform a raw-value into a formatted text.String
getFormula()
Returns the formula used to compute the value of the data source.String
getNullValue()
Returns the value displayed by the field when the data source value isnull
.Object
getRawValue(ExpressionRuntime runtime, ReportElement element)
Returns the unformated raw value.Object
getValue(ExpressionRuntime runtime, ReportElement element)
Returns the current value for the data source.void
setField(String field)
Sets the field name.void
setFormula(String formula)
Defines the formula used to compute the value of this data source.void
setNullValue(String nullValue)
Sets the value displayed by the field when the data source value isnull
.-
Methods inherited from class org.pentaho.reporting.engine.classic.core.filter.templates.AbstractTemplate
getInstance, getName, setName
-
-
-
-
Method Detail
-
getField
public String getField()
Returns the field name.- Returns:
- The field name.
-
setField
public void setField(String field)
Sets the field name.- Parameters:
field
- the field name.
-
getFormula
public String getFormula()
Returns the formula used to compute the value of the data source.- Returns:
- the formula.
-
setFormula
public void setFormula(String formula)
Defines the formula used to compute the value of this data source.- Parameters:
formula
- the formula for the data source.
-
getNullValue
public String getNullValue()
Returns the value displayed by the field when the data source value isnull
.- Returns:
- A value to represent
null
.
-
setNullValue
public void setNullValue(String nullValue)
Sets the value displayed by the field when the data source value isnull
.- Parameters:
nullValue
- the value that representsnull
.
-
getValue
public Object getValue(ExpressionRuntime runtime, ReportElement element)
Returns the current value for the data source.- 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 value.
-
clone
public StringFieldTemplate clone() throws CloneNotSupportedException
Clones the template.- Specified by:
clone
in interfaceDataSource
- Overrides:
clone
in classAbstractTemplate
- Returns:
- the clone.
- Throws:
CloneNotSupportedException
- this should never happen.
-
getDataRowDataSource
protected DataRowDataSource getDataRowDataSource()
Returns the datarow data source used in this template.- Returns:
- the datarow data source.
-
getRawValue
public Object getRawValue(ExpressionRuntime runtime, ReportElement element)
Description copied from interface:RawDataSource
Returns the unformated raw value. Whether that raw value is useable for the export is beyond the scope of this API definition, but providing access toNumber
orDate
objects is a good idea.- Specified by:
getRawValue
in interfaceRawDataSource
- Parameters:
runtime
- the expression runtime that is used to evaluate formulas and expressions when computing the value of this filter.- Returns:
- the raw data.
-
getFormatString
public FormatSpecification getFormatString(ExpressionRuntime runtime, ReportElement element, FormatSpecification formatSpecification)
Description copied from interface:RawDataSource
Returns information about the formatstring that was used to transform a raw-value into a formatted text. Not all elements will make use of a format-string. These elements will return.classic.core.filter.FormatSpecification#TYPE_UNDEFINED
in that case.- Specified by:
getFormatString
in interfaceRawDataSource
- Parameters:
runtime
- the Expression runtime used to possibly compute the raw-value.element
- the element to which this datasource is added.formatSpecification
- the format specification (can be null). @return a filled format specififcation. If theformatSpecification
parameter was not null, this given instance is reused.
-
-