Package org.apache.nutch.urlfilter.api
Class RegexRule
java.lang.Object
org.apache.nutch.urlfilter.api.RegexRule
A generic regular expression rule.
- Author:
- Jérôme Charron
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanaccept()Return if this rule is used for filtering-in or out.protected StringReturn if this rule is used for filtering-in or out.protected abstract booleanChecks if a url matches this rule.protected Stringregex()Return if this rule's regex.
-
Constructor Details
-
RegexRule
Constructs a new regular expression rule.- Parameters:
sign- specifies if this rule must filter-in or filter-out. Atruevalue means that any url matching this rule must be accepted, afalsevalue means that any url matching this rule must be rejected.regex- is the regular expression used for matching (seematch(String)method).
-
RegexRule
Constructs a new regular expression rule.- Parameters:
sign- specifies if this rule must filter-in or filter-out. Atruevalue means that any url matching this rule must be accepted, afalsevalue means that any url matching this rule must be rejected.regex- is the regular expression used for matching (seematch(String)method).hostOrDomain- the host or domain to which this regex belongs
-
-
Method Details
-
accept
protected boolean accept()Return if this rule is used for filtering-in or out.- Returns:
trueif any url matching this rule must be accepted, otherwisefalse.
-
hostOrDomain
Return if this rule is used for filtering-in or out.- Returns:
- host or domain this regex rule belongs to
-
regex
Return if this rule's regex.- Returns:
- this regex
-
match
Checks if a url matches this rule.- Parameters:
url- is the url to check.- Returns:
trueif the specified url matches this rule, otherwisefalse.
-