public interface IFilterConfigurationMapper extends IParametersEditorMapper
This interface allows you to add and remove filter configurations from a central place. You can instantiate the filter corresponding to a given configuration, as well as manipulate its parameters.
Classes that implements this interface should consider overriding the methods
related to custom configurations to provide application-specific storage mechanism
and naming convention. The methods related to custom configurations are, for example:
createCustomConfiguration(FilterConfiguration)
,
deleteCustomParameters(FilterConfiguration)
,
getCustomParameters(FilterConfiguration)
,
getCustomParameters(FilterConfiguration, IFilter)
, and
saveCustomParameters(FilterConfiguration, IParameters)
.
Modifier and Type | Method and Description |
---|---|
void |
addConfiguration(FilterConfiguration config)
Adds a new configuration to this mapper.
|
void |
addConfigurations(java.lang.String filterClass)
Adds all the predefined configurations of a given filter to this mapper.
|
void |
addEditor(java.lang.String editorClass,
java.lang.String parametersClass)
Adds a new editor mapping to this mapper.
|
void |
clearConfigurations(boolean customOnly)
Removes configuration mappings from this mapper.
|
void |
clearEditors()
Removes all editor mappings for this mapper.
|
IParametersEditor |
createConfigurationEditor(java.lang.String configId)
Creates an instance of the filter's parameters editor for a given
configuration identifier.
|
IParametersEditor |
createConfigurationEditor(java.lang.String configId,
IFilter existingFilter)
Creates an instance of the filter's parameters editor for a given
configuration identifier.
|
FilterConfiguration |
createCustomConfiguration(FilterConfiguration baseConfig)
Creates a custom configuration object based on a give one.
|
IFilter |
createFilter(java.lang.String configId)
Creates an instance of the filter for a given configuration identifier
and loads its corresponding parameters.
|
IFilter |
createFilter(java.lang.String configId,
IFilter existingFilter)
Creates an instance of the filter for a given configuration identifier
and loads its corresponding parameters.
|
void |
deleteCustomParameters(FilterConfiguration config)
Deletes the parameters of a custom configuration.
|
java.util.Iterator<FilterConfiguration> |
getAllConfigurations()
Gets an iterator on all configurations objects for this mapper.
|
FilterConfiguration |
getConfiguration(java.lang.String configId)
Gets the FilterConfiguration object for a given configuration identifier.
|
IParameters |
getCustomParameters(FilterConfiguration config)
Gets the parameters for a given custom filter configuration.
|
IParameters |
getCustomParameters(FilterConfiguration config,
IFilter existingFilter)
Gets the parameters for a given custom filter configuration.
|
FilterConfiguration |
getDefaultConfiguration(java.lang.String mimeType)
Gets the first filter configuration for a given MIME type.
|
FilterConfiguration |
getDefaultConfigurationFromExtension(java.lang.String ext)
Gets the first filter configuration for a given extension.
|
java.util.List<FilterConfiguration> |
getFilterConfigurations(java.lang.String filterClass)
Gets a list of all FilterConfiguration objects for a given filter class.
|
java.util.List<FilterInfo> |
getFiltersInfo()
Gets a list of information on all filters in this mapper.
|
java.util.List<FilterConfiguration> |
getMimeConfigurations(java.lang.String mimeType)
Gets a list of all FilterConfiguration objects for a given MIME type.
|
IParameters |
getParameters(FilterConfiguration config)
Gets the parameters for a given configuration (predefined or custom).
|
IParameters |
getParameters(FilterConfiguration config,
IFilter existingFilter)
Gets the parameters for a given configuration (predefined or custom).
|
void |
removeConfiguration(java.lang.String configId)
Removes a given configuration from this mapper.
|
void |
removeConfigurations(java.lang.String filterClass)
Removes all the configurations (predefined and custom) of a given
filter from this mapper.
|
void |
removeEditor(java.lang.String editorClass)
Removes a given editor from this mapper.
|
void |
saveCustomParameters(FilterConfiguration config,
IParameters params)
Saves the parameters of a custom configuration.
|
addDescriptionProvider, addDescriptionProvider, addEditor, clearDescriptionProviders, createParametersEditor, getDescriptionProvider, removeDescriptionProvider
void addConfiguration(FilterConfiguration config)
config
- the configuration to add.void removeConfiguration(java.lang.String configId)
configId
- the identifier of the configuration to remove.void addConfigurations(java.lang.String filterClass)
filterClass
- the class name of the filter to lookup.void removeConfigurations(java.lang.String filterClass)
filterClass
- the class name of the filter to lookup.void clearConfigurations(boolean customOnly)
customOnly
- true to clear only the custom configurations, false to
clear all the configurations from this mapper.void addEditor(java.lang.String editorClass, java.lang.String parametersClass)
addEditor
in interface IParametersEditorMapper
editorClass
- the class name of the editor to add.parametersClass
- the class name of the parameters this editor can edit.void removeEditor(java.lang.String editorClass)
removeEditor
in interface IParametersEditorMapper
editorClass
- the class name of the editor to remove.void clearEditors()
clearEditors
in interface IParametersEditorMapper
IFilter createFilter(java.lang.String configId, IFilter existingFilter)
configId
- the configuration identifier to use for look-up.existingFilter
- an optional existing instance of a filter. This argument can be null.
If this argument is not null, it is checked against the requested filter and re-use
if the requested filter and the provided instance are the same. If the provided
instance is re-used, its parameters are always re-loaded.
Providing an existing instance of the requested filter may allow for better
efficiency.IFilter
object (with its parameters loaded) for the given
configuration identifier, or null if the object could not be created.OkapiFilterCreationException
- if the filter could not be created.IFilter createFilter(java.lang.String configId)
configId
- the configuration identifier to use for look-up.IFilter
object (with its parameters loaded) for the given
configuration identifier, or null if the object could not be created.OkapiFilterCreationException
- if the filter could not be created.IParametersEditor createConfigurationEditor(java.lang.String configId, IFilter existingFilter)
configId
- the configuration identifier to use for look-up.existingFilter
- an optional existing instance of a filter. This
argument can be null. If this argument is not null and matches the filter
of the given configuration it is used instead of a temporay instance, to
get an instance of the parameters object for which the editor is requested.OkapiFilterCreationException
- if a filter needed to be created
and could not.OkapiEditorCreationException
- if the editor could not be created.IParametersEditor createConfigurationEditor(java.lang.String configId)
configId
- the configuration identifier to use for look-up.OkapiFilterCreationException
- if a filter needed to be created
and could not.OkapiEditorCreationException
- if the editor could not be created.FilterConfiguration getConfiguration(java.lang.String configId)
configId
- the configuration identifier to search for.FilterConfiguration getDefaultConfiguration(java.lang.String mimeType)
mimeType
- MIME type to search for.FilterConfiguration getDefaultConfigurationFromExtension(java.lang.String ext)
ext
- the extension to search for (must be in the form ".ext"
but can be in any case).java.util.List<FilterInfo> getFiltersInfo()
java.util.Iterator<FilterConfiguration> getAllConfigurations()
java.util.List<FilterConfiguration> getMimeConfigurations(java.lang.String mimeType)
mimeType
- mimeType MIME type to search for.java.util.List<FilterConfiguration> getFilterConfigurations(java.lang.String filterClass)
filterClass
- the class name of the filter to search for.IParameters getParameters(FilterConfiguration config)
config
- the configuration for which the parameters are requested.getCustomParameters(FilterConfiguration)
IParameters getParameters(FilterConfiguration config, IFilter existingFilter)
config
- the configuration for which the parameters are requested.existingFilter
- optional existing instance of the filter for the given
configuration. This argument can be null. If it not null, the provided filter
may be used to load the parameters (if it matches the appropriate class).
Providing this argument may allow the method to be more efficient by not
creating a temporary filter to get an instance of the parameters to load.FilterConfiguration createCustomConfiguration(FilterConfiguration baseConfig)
baseConfig
- the base configuration from which to base the new one.FilterConfiguration
object set with some
default values, or null if the configuration could not be created.IParameters getCustomParameters(FilterConfiguration config, IFilter existingFilter)
config
- the custom configuration for which the method should return the
filter parameters.existingFilter
- optional existing instance of the filter for the given
configuration. This argument can be null. If it not null, the provided filter
may be used to load the parameters (if it matches the appropriate class).
Providing this argument may allow the method to be more efficient by not
creating a temporary filter to get an instance of the parameters to load.OkapiFilterCreationException
- if the filter of the given configuration
could not be created to load the parameters.IParameters getCustomParameters(FilterConfiguration config)
config
- the custom configuration for which the method should return the
filter parameters.OkapiFilterCreationException
- if the filter of the given configuration
could not be created to load the parameters.getParameters(FilterConfiguration)
void saveCustomParameters(FilterConfiguration config, IParameters params)
config
- the custom configuration for which to save the parameters.params
- the parameters to save.void deleteCustomParameters(FilterConfiguration config)
removeConfiguration(String)
.config
- the custom configuration for which to delete the parameters.Copyright © 2022. All rights reserved.