Class TextFormatExpression
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.function.AbstractExpression
-
- org.pentaho.reporting.engine.classic.core.function.TextFormatExpression
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Expression
public class TextFormatExpression extends AbstractExpression
Deprecated.Use the MessageFormatExpression instead.A TextFormatExpression uses a java.text.MessageFormat to concat and format one or more values evaluated from an expression, function or report datasource. The TextFormatExpression uses the pattern property to define the global format-pattern used when evaluating the expression. The dataRow fields used to fill the expressions placeholders are defined in a list of properties where the property-names are numbers. The property counting starts at "0". The Syntax of thepattern
property is explained in the classMessageFormat
. Example:Invoice for your order from {0, date, EEE, MMM d, yyyy} printdate MessageFormatExpression
allows to specify named field-references in the pattern, which greatly simplifies the pattern-definition.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TextFormatExpression()
Deprecated.Default constructor, creates a new unnamed TextFormatExpression.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
getEncoding()
Deprecated.Returns the defined character encoding that is used to transform the Java-Unicode strings into bytes.String[]
getField()
Deprecated.Returns all defined fields as array of strings.String
getField(int index)
Deprecated.Returns the defined field at the given index-position.int
getFieldCount()
Deprecated.Returns the number of fields defined in this expression.protected Object[]
getFieldValues(Object[] retval)
Deprecated.Collects the values of all fields defined in the fieldList.Expression
getInstance()
Deprecated.Return a completly separated copy of this function.String
getPattern()
Deprecated.Returns the pattern defined for this expression.Object
getValue()
Deprecated.Evaluates the expression by collecting all values defined in the fieldlist from the datarow.boolean
isUrlEncodeResult()
Deprecated.Queries, whether the formatted result-string will be URL encoded.boolean
isUrlEncodeValues()
Deprecated.Queries, whether the values read from the data-row should be URL encoded.void
setEncoding(String encoding)
Deprecated.Defines the character encoding that is used to transform the Java-Unicode strings into bytes.void
setField(int index, String field)
Deprecated.Defines the field in the field-list at the given index.void
setField(String[] fields)
Deprecated.Defines all fields as array.void
setPattern(String pattern)
Deprecated.Defines the pattern for this expression.void
setUrlEncodeResult(boolean urlEncodeResult)
Deprecated.Defines, whether the formatted result-string will be URL encoded.void
setUrlEncodeValues(boolean urlEncode)
Deprecated.Defines, whether the values read from the data-row should be URL encoded.-
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractExpression
clone, getDataRow, getDependencyLevel, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setActive, setDependencyLevel, setName, setPreserve, setRuntime
-
-
-
-
Method Detail
-
getEncoding
public String getEncoding()
Deprecated.Returns the defined character encoding that is used to transform the Java-Unicode strings into bytes.- Returns:
- the encoding.
-
setEncoding
public void setEncoding(String encoding)
Deprecated.Defines the character encoding that is used to transform the Java-Unicode strings into bytes.- Parameters:
encoding
- the encoding.
-
setUrlEncodeValues
public void setUrlEncodeValues(boolean urlEncode)
Deprecated.Defines, whether the values read from the data-row should be URL encoded. Dates and Number objects are never encoded.- Parameters:
urlEncode
- true, if the values from the data-row should be URL encoded before they are passed to the MessageFormat, false otherwise.
-
isUrlEncodeValues
public boolean isUrlEncodeValues()
Deprecated.Queries, whether the values read from the data-row should be URL encoded.- Returns:
- true, if the values are encoded, false otherwise.
-
isUrlEncodeResult
public boolean isUrlEncodeResult()
Deprecated.Queries, whether the formatted result-string will be URL encoded.- Returns:
- true, if the formatted result will be encoded, false otherwise.
-
setUrlEncodeResult
public void setUrlEncodeResult(boolean urlEncodeResult)
Deprecated.Defines, whether the formatted result-string will be URL encoded.- Parameters:
urlEncodeResult
- true, if the formatted result will be encoded, false otherwise.
-
getValue
public Object getValue()
Deprecated.Evaluates the expression by collecting all values defined in the fieldlist from the datarow. The collected values are then parsed and formated by the MessageFormat-object.- Returns:
- a string containing the pattern inclusive the formatted values from the datarow
-
getFieldValues
protected Object[] getFieldValues(Object[] retval) throws UnsupportedEncodingException
Deprecated.Collects the values of all fields defined in the fieldList.- Parameters:
retval
- an optional array that will receive the field values.- Returns:
- an Object-array containing all defined values from the datarow
- Throws:
UnsupportedEncodingException
- if the character encoding is not recognized by the JDK.
-
getPattern
public String getPattern()
Deprecated.Returns the pattern defined for this expression.- Returns:
- the pattern.
-
setPattern
public void setPattern(String pattern)
Deprecated.Defines the pattern for this expression. The pattern syntax is defined by the java.text.MessageFormat object and the given pattern string has to be valid according to the rules defined there.- Parameters:
pattern
- the pattern string
-
getInstance
public Expression getInstance()
Deprecated.Return a completly separated copy of this function. The copy does no longer share any changeable objects with the original function.- Specified by:
getInstance
in interfaceExpression
- Overrides:
getInstance
in classAbstractExpression
- Returns:
- a copy of this function.
-
setField
public void setField(int index, String field)
Deprecated.Defines the field in the field-list at the given index.- Parameters:
index
- the position in the list, where the field should be defined.field
- the name of the field.
-
getField
public String getField(int index)
Deprecated.Returns the defined field at the given index-position.- Parameters:
index
- the position of the field name that should be queried.- Returns:
- the field name at the given position.
-
getFieldCount
public int getFieldCount()
Deprecated.Returns the number of fields defined in this expression.- Returns:
- the number of fields.
-
getField
public String[] getField()
Deprecated.Returns all defined fields as array of strings.- Returns:
- all the fields.
-
setField
public void setField(String[] fields)
Deprecated.Defines all fields as array. This completely replaces any previously defined fields.- Parameters:
fields
- the new list of fields.
-
-