org.pentaho.reporting.engine.classic.core.filter
Class ResourceMessageFormatFilter

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.filter.ResourceMessageFormatFilter
All Implemented Interfaces:
Serializable, Cloneable, DataSource

public class ResourceMessageFormatFilter
extends Object
implements DataSource

A filter that formats values from the datarow using a message format object. The message format string is looked up from a Resource-Bundle.

Since:
2006-01-24
Author:
Thomas Morgner
See Also:
Serialized Form

Constructor Summary
ResourceMessageFormatFilter()
          Default constructor.
 
Method Summary
 Object clone()
          Clones this DataSource.
 String getFormatKey()
          Returns the key that is used to lookup the format string used in the message format in the resource bundle.
 String getNullString()
          Returns the replacement text that is used if one of the referenced message parameters is null.
 String getResourceIdentifier()
          Returns the name of the used resource bundle.
 Object getValue(ExpressionRuntime runtime, Element element)
          Returns the current value for the data source.
 void setFormatKey(String format)
          Defines the key that is used to lookup the format string used in the message format in the resource bundle.
 void setNullString(String nullString)
          Defines the replacement text that is used if one of the referenced message parameters is null.
 void setResourceIdentifier(String resourceIdentifier)
          Defines the name of the used resource bundle.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceMessageFormatFilter

public ResourceMessageFormatFilter()
Default constructor.

Method Detail

getValue

public Object getValue(ExpressionRuntime runtime,
                       Element element)
Returns the current value for the data source.

Specified by:
getValue in interface DataSource
Parameters:
runtime - the expression runtime that is used to evaluate formulas and expressions when computing the value of this filter.
element -
Returns:
the value.

getResourceIdentifier

public String getResourceIdentifier()
Returns the name of the used resource bundle.

Returns:
the name of the resourcebundle
See Also:
ResourceBundleFactory.getResourceBundle(String)

setResourceIdentifier

public void setResourceIdentifier(String resourceIdentifier)
Defines the name of the used resource bundle. If undefined, all calls to DataSource.getValue(ExpressionRuntime, Element) will result in null values.

Parameters:
resourceIdentifier - the resource bundle name

setFormatKey

public void setFormatKey(String format)
Defines the key that is used to lookup the format string used in the message format in the resource bundle.

Parameters:
format - a resourcebundle key for the message format lookup.

getFormatKey

public String getFormatKey()
Returns the key that is used to lookup the format string used in the message format in the resource bundle.

Returns:
the resource bundle key.

clone

public Object clone()
             throws CloneNotSupportedException
Clones this DataSource.

Specified by:
clone in interface DataSource
Overrides:
clone in class Object
Returns:
the clone.
Throws:
CloneNotSupportedException - this should never happen.

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.