org.pentaho.reporting.engine.classic.core.function.strings
Class MessageFormatExpression

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.function.AbstractExpression
      extended by org.pentaho.reporting.engine.classic.core.function.strings.MessageFormatExpression
All Implemented Interfaces:
Serializable, Cloneable, Expression

public class MessageFormatExpression
extends AbstractExpression

Formats a message using named parameters. The parameters are resolved against the current data-row.

This performs the same task as the MessageFormatFilter does inside a text-element.

Author:
Thomas Morgner
See Also:
Serialized Form

Constructor Summary
MessageFormatExpression()
          Default constructor.
 
Method Summary
 String getEncoding()
          Returns the defined character encoding that is used to transform the Java-Unicode strings into bytes.
 Expression getInstance()
          Return a completly separated copy of this function.
 String getNullString()
          Returns the replacement text that is used if one of the referenced message parameters is null.
 String getPattern()
          Returns the format string used in the message format.
 Object getValue()
          Returns the formatted message.
 boolean isUrlEncodeResult()
          Queries, whether the formatted result-string will be URL encoded.
 boolean isUrlEncodeValues()
          Queries, whether the values read from the data-row should be URL encoded.
 void setEncoding(String encoding)
          Defines the character encoding that is used to transform the Java-Unicode strings into bytes.
 void setNullString(String nullString)
          Defines the replacement text that is used if one of the referenced message parameters is null.
 void setPattern(String pattern)
          Defines the format string for the MessageFormat object used in this implementation.
 void setUrlEncodeResult(boolean urlEncodeResult)
          Defines, whether the formatted result-string will be URL encoded.
 void setUrlEncodeValues(boolean urlEncode)
          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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageFormatExpression

public MessageFormatExpression()
Default constructor.

Method Detail

getPattern

public String getPattern()
Returns the format string used in the message format.

Returns:
the format string.

setPattern

public void setPattern(String pattern)
Defines the format string for the MessageFormat object used in this implementation.

Parameters:
pattern - the message format.

getEncoding

public String getEncoding()
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)
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)
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()
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()
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)
Defines, whether the formatted result-string will be URL encoded.

Parameters:
urlEncodeResult - true, if the formatted result will be encoded, false otherwise.

getNullString

public String getNullString()
Returns the replacement text that is used if one of the referenced message parameters is null.

Returns:
the replacement text for null-values.

setNullString

public void setNullString(String nullString)
Defines the replacement text that is used if one of the referenced message parameters is null.

Parameters:
nullString - the replacement text for null-values.

getValue

public Object getValue()
Returns the formatted message.

Returns:
the formatted message.

getInstance

public Expression getInstance()
Description copied from class: AbstractExpression
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 interface Expression
Overrides:
getInstance in class AbstractExpression
Returns:
a copy of this function.