com.jrefinery.report.filter
Class ResourceFileFilter

java.lang.Object
  extended bycom.jrefinery.report.filter.ResourceFileFilter
All Implemented Interfaces:
java.lang.Cloneable, DataFilter, DataSource, DataTarget, java.io.Serializable

public class ResourceFileFilter
extends java.lang.Object
implements DataFilter, java.io.Serializable

Lookup a key from a datasource using a ResourceBundle.

Filters a given datasource and uses the datasource value as key for a ResourceBundle.

Author:
Thomas Morgner
See Also:
Serialized Form

Constructor Summary
ResourceFileFilter()
          Creates a new ResourceFileFilter.
 
Method Summary
 java.lang.Object clone()
          Clones this DataSource.
 DataSource getDataSource()
          Returns the assigned DataSource for this Target.
 java.util.ResourceBundle getResources()
          Gets the assigned resource bundle, or null, if no resource bundle is defined.
 java.lang.Object getValue()
          Returns the current value for the data source.
 void setDataSource(DataSource ds)
          Assigns a DataSource for this Target.
 void setResources(java.util.ResourceBundle resources)
          Defines a resource bundle for this filter.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceFileFilter

public ResourceFileFilter()
Creates a new ResourceFileFilter.

Method Detail

getResources

public java.util.ResourceBundle getResources()
Gets the assigned resource bundle, or null, if no resource bundle is defined.

Returns:
the defined ResourceBundle or null.

setResources

public void setResources(java.util.ResourceBundle resources)
Defines a resource bundle for this filter.

Parameters:
resources - the resource bundle used to lookup the value.

getValue

public java.lang.Object getValue()
Returns the current value for the data source. The method will return null, if no datasource or no resource bundle is defined or if the datasource's value is null.

The value read from the dataSource is looked up in the given resourcebundle using the ResourceBundle.getObject() method. If the lookup fails, null is returned.

Specified by:
getValue in interface DataSource
Returns:
the value or null, if the value could not be looked up.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clones this DataSource.

Specified by:
clone in interface DataSource
Returns:
the clone.
Throws:
java.lang.CloneNotSupportedException - this should never happen.

getDataSource

public DataSource getDataSource()
Returns the assigned DataSource for this Target.

Specified by:
getDataSource in interface DataTarget
Returns:
The datasource.

setDataSource

public void setDataSource(DataSource ds)
Assigns a DataSource for this Target.

Specified by:
setDataSource in interface DataTarget
Parameters:
ds - The data source.