public class ExtensionReferenceFilter extends AbstractOnMatchFilter implements 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>
The following example will only accept references with the following extensions: .html, .htm, .php, and .asp.
<filter class="com.norconex.collector.core.filter.impl.ExtensionReferenceFilter"> html,htm,php,asp </filter>
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(ImporterDocument 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 obj) |
String[] |
getExtensionParts() |
String |
getExtensions() |
int |
hashCode() |
boolean |
isCaseSensitive() |
void |
loadFromXML(Reader in) |
void |
saveToXML(Writer out) |
void |
setCaseSensitive(boolean caseSensitive) |
void |
setExtensions(String extensions) |
String |
toString() |
getOnMatch, loadFromXML, saveToXML, setOnMatch
public ExtensionReferenceFilter()
public ExtensionReferenceFilter(String extensions)
public boolean acceptReference(String reference)
IReferenceFilter
acceptReference
in interface IReferenceFilter
reference
- the reference to accept/rejecttrue
if accepted, false
otherwisepublic String getExtensions()
public String[] getExtensionParts()
public boolean isCaseSensitive()
public final void setCaseSensitive(boolean caseSensitive)
public final void setExtensions(String extensions)
public void loadFromXML(Reader in)
loadFromXML
in interface IXMLConfigurable
public void saveToXML(Writer out) throws IOException
saveToXML
in interface IXMLConfigurable
IOException
public boolean acceptDocument(ImporterDocument 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
otherwisepublic String toString()
toString
in class AbstractOnMatchFilter
public int hashCode()
hashCode
in class AbstractOnMatchFilter
public boolean equals(Object obj)
equals
in class AbstractOnMatchFilter
Copyright © 2014–2021 Norconex Inc.. All rights reserved.