de.grogra.pf.io
public abstract class FilterBase extends java.lang.Object implements Filter, FilterSource, Map
Filters. Its implementation of getMetaData
forwards to #getImpl(Object, Object) firstly, then to
the item which defines this filter, then to
the meta data of the source, and returns the first value
which could be found this way.FilterSource.MetaDataKey<V>| Modifier and Type | Field and Description |
|---|---|
protected FilterItem |
item
The defining
FilterItem for this filter. |
protected FilterSource |
source
The data source of this filter.
|
AUTO_PROGRESS, DESTINATION_FILE, DESTINATION_URLDEFAULT_VALUE, EMPTY_MAP| Constructor and Description |
|---|
FilterBase(FilterItem item,
FilterSource source)
Creates a new
FilterBase, initializes its
item and source fields and
sets the system id to the system id of the source. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
get(java.lang.Object key,
java.lang.Object defaultValue)
Returns the value associated with
key. |
Filter |
getFilter()
Returns the
Filter from which this instance obtains its data. |
IOFlavor |
getFlavor()
Returns the
IOFlavor of this data source. |
protected java.lang.Object |
getImpl(FilterSource.MetaDataKey key,
java.lang.Object defaultValue)
This method is invoked by
get(Object, Object). |
<V> V |
getMetaData(FilterSource.MetaDataKey<V> key,
V defaultValue) |
Registry |
getRegistry()
Returns the
Registry which is linked with this instance. |
FilterSource |
getSource()
Returns the data source of this filter.
|
java.lang.String |
getSystemId()
Returns a system id which identifies this source.
|
void |
initProgressMonitor(ProgressMonitor monitor) |
protected void |
setFlavor(IOFlavor flavor) |
<V> void |
setMetaData(FilterSource.MetaDataKey<V> key,
V value) |
protected void |
setMetaData(Map metaData)
Sets the internal meta data map to the specified map.
|
void |
setProgress(java.lang.String text,
float progress) |
protected void |
setSystemId(java.lang.String systemId) |
java.lang.String |
toString() |
java.net.URL |
toURL() |
protected final FilterItem item
FilterItem for this filter.protected final FilterSource source
public FilterBase(FilterItem item, FilterSource source)
FilterBase, initializes its
item and source fields and
sets the system id to the system id of the source.item - the defining FilterItemsource - the data sourcepublic java.lang.Object get(java.lang.Object key,
java.lang.Object defaultValue)
Mapkey. If there is
no value associated with key, defaultValue
is returned.public final Filter getFilter()
FilterSourceFilter from which this instance obtains its data.
If there is no such filter, i.e., if this is the first object
in the filter pipeline, this method returns null.getFilter in interface FilterSourcenullpublic final IOFlavor getFlavor()
FilterSourceIOFlavor of this data source. Depending on the
flavor, this instance has to implement corresponding subinterfaces
of FilterSource.getFlavor in interface FilterSourceprotected java.lang.Object getImpl(FilterSource.MetaDataKey key, java.lang.Object defaultValue)
get(Object, Object). This default
implementation forwards to the internal meta data map
(see setMetaData(Map)), or returns defaultValue
if no such internal map has been set.key - a keydefaultValue - a default valuedefaultValuepublic <V> V getMetaData(FilterSource.MetaDataKey<V> key, V defaultValue)
getMetaData in interface FilterSourcepublic final Registry getRegistry()
RegistryContextRegistry which is linked with this instance.getRegistry in interface RegistryContextpublic final FilterSource getSource()
Filterpublic final java.lang.String getSystemId()
FilterSourcegetSystemId in interface FilterSourcepublic void initProgressMonitor(ProgressMonitor monitor)
initProgressMonitor in interface FilterSourceprotected final void setFlavor(IOFlavor flavor)
public <V> void setMetaData(FilterSource.MetaDataKey<V> key, V value)
setMetaData in interface FilterSourceprotected void setMetaData(Map metaData)
metaData - a value for the internal meta data mappublic void setProgress(java.lang.String text,
float progress)
setProgress in interface FilterSourceprotected final void setSystemId(java.lang.String systemId)
public java.lang.String toString()
toString in class java.lang.Objectpublic java.net.URL toURL()
throws java.net.MalformedURLException
java.net.MalformedURLException