public class ExtensionReferenceFilter extends Object implements IOnMatchFilter, IReferenceFilter, IDocumentFilter, IMetadataFilter, IXMLConfigurable
Filters a reference based on a comma-separated list of extensions. Extensions are typically the last characters of a file name, after the last dot.
<filter
class="com.norconex.collector.core.filter.impl.ExtensionReferenceFilter"
onMatch="[include|exclude]"
caseSensitive="[false|true]">
(comma-separated list of extensions)
</filter>
<filter
class="com.norconex.collector.core.filter.impl.ExtensionReferenceFilter">
html,htm,php,asp
</filter>
The above example will only accept references with the following extensions: .html, .htm, .php, and .asp.
Constructor and Description |
---|
ExtensionReferenceFilter() |
ExtensionReferenceFilter(String extensions) |
ExtensionReferenceFilter(String extensions,
OnMatch onMatch) |
ExtensionReferenceFilter(String extensions,
OnMatch onMatch,
boolean caseSensitive) |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptDocument(Doc document)
Whether to accept a document.
|
boolean |
acceptMetadata(String reference,
Properties metadata)
Whether to accept the metadata.
|
boolean |
acceptReference(String reference)
Whether to accept this reference.
|
boolean |
equals(Object other) |
Set<String> |
getExtensions() |
OnMatch |
getOnMatch() |
int |
hashCode() |
boolean |
isCaseSensitive() |
void |
loadFromXML(XML xml) |
void |
saveToXML(XML xml) |
void |
setCaseSensitive(boolean caseSensitive) |
void |
setExtensions(List<String> extensions) |
void |
setExtensions(String... extensions) |
void |
setOnMatch(OnMatch onMatch) |
String |
toString() |
public ExtensionReferenceFilter()
public ExtensionReferenceFilter(String extensions)
public OnMatch getOnMatch()
getOnMatch
in interface IOnMatchFilter
public void setOnMatch(OnMatch onMatch)
public boolean acceptReference(String reference)
IReferenceFilter
acceptReference
in interface IReferenceFilter
reference
- the reference to accept/rejecttrue
if accepted, false
otherwisepublic void setExtensions(String... extensions)
public boolean isCaseSensitive()
public final void setCaseSensitive(boolean caseSensitive)
public void loadFromXML(XML xml)
loadFromXML
in interface IXMLConfigurable
public void saveToXML(XML xml)
saveToXML
in interface IXMLConfigurable
public boolean acceptDocument(Doc document)
IDocumentFilter
acceptDocument
in interface IDocumentFilter
document
- the document to accept/rejecttrue
if accepted, false
otherwisepublic boolean acceptMetadata(String reference, Properties metadata)
IMetadataFilter
acceptMetadata
in interface IMetadataFilter
reference
- the reference associated with the metadatametadata
- metadata associated with the referencetrue
if accepted, false
otherwiseCopyright © 2014–2023 Norconex Inc.. All rights reserved.