com.jrefinery.report.filter
Class URLFilter

java.lang.Object
  |
  +--com.jrefinery.report.filter.URLFilter
All Implemented Interfaces:
java.lang.Cloneable, DataFilter, DataSource, DataTarget, java.io.Serializable

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

The URLFilter forms URLs from Strings ,Files and URLs. If an URL is relative, the missing contents can be obtained by a default url, called the baseURL.

Author:
Thomas Morgner
See Also:
Serialized Form

Constructor Summary
URLFilter()
          DefaultConstructor.
 
Method Summary
 java.lang.Object clone()
          Creates a clone of the URL filter.
 java.net.URL getBaseURL()
          Gets the base url used to make relative URLs absolute.
 DataSource getDataSource()
          Returns the data source for the filter.
 java.lang.Object getValue()
          Tries to form a url from the object returned from the datasource.
 void setBaseURL(java.net.URL baseURL)
          Defines the base url used to complete relative urls.
 void setDataSource(DataSource ds)
          Sets the data source.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLFilter

public URLFilter()
DefaultConstructor.

Method Detail

getDataSource

public DataSource getDataSource()
Returns the data source for the filter.

Specified by:
getDataSource in interface DataTarget
Returns:
The data source.

setDataSource

public void setDataSource(DataSource ds)
Sets the data source.

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

getValue

public java.lang.Object getValue()
Tries to form a url from the object returned from the datasource. This function will return null if the datasource is null or returned null when getValue was called. Null is also returned if the datasources value is not an url, a String or a file. If the creation of the url failed with an MalformedURLException or the datasource returned a file which is not readable, also null is returned.

Specified by:
getValue in interface DataSource
Returns:
created url or null if something went wrong on url creation.

getBaseURL

public java.net.URL getBaseURL()
Gets the base url used to make relative URLs absolute.

Returns:
the base url used to complete relative urls.

setBaseURL

public void setBaseURL(java.net.URL baseURL)
Defines the base url used to complete relative urls.

Parameters:
baseURL - the base URL.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates a clone of the URL filter.

Specified by:
clone in interface DataSource
Overrides:
clone in class java.lang.Object
Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException - should never happen.