Package org.apache.rat.analysis.matchers
Class CopyrightMatcher
java.lang.Object
org.apache.rat.analysis.matchers.AbstractHeaderMatcher
org.apache.rat.analysis.matchers.AbstractSimpleMatcher
org.apache.rat.analysis.matchers.CopyrightMatcher
- All Implemented Interfaces:
IHeaderMatcher
Matches a typical Copyright header line only based on a regex pattern which
allows for one (starting) year or year range, and a configurable copyright
owner.
The matching is done case insensitive
Example supported Copyright header lines, using copyright owner "FooBar"
The matching is done case insensitive
Example supported Copyright header lines, using copyright owner "FooBar"
- Copyright 2010 FooBar.
- Copyright 2010-2012 FooBar.
- copyright 2012 foobar
Note also that the copyright owner is appended to the regex pattern and so can
support additional regex but also requires escaping where needed,
e.g. use "FooBar \\(www\\.foobar\\.com\\)" or
"FooBar \\Q(www.foobar.com)\\E" to match "FooBar
(www.foobar.com)"
The matcher also accepts "(C)", "(c)", and "©" in place of (or in addition to) the "Copyright" or "copyright" keyword
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.rat.analysis.IHeaderMatcher
IHeaderMatcher.Builder, IHeaderMatcher.State
-
Constructor Summary
ConstructorDescriptionCopyrightMatcher(String start, String stop, String owner)
Constructs the CopyrightMatcher with the specified start, stop and owner strings and a unique random id..CopyrightMatcher(String id, String start, String stop, String owner)
Constructs the CopyrightMatcher with the specified start, stop and owner strings. -
Method Summary
Methods inherited from class org.apache.rat.analysis.matchers.AbstractSimpleMatcher
currentState, finalizeState, matches, reset
Methods inherited from class org.apache.rat.analysis.matchers.AbstractHeaderMatcher
getId, toString
-
Constructor Details
-
CopyrightMatcher
Constructs the CopyrightMatcher with the specified start, stop and owner strings and a unique random id..- Parameters:
start
- the start date for the copyright may be null.stop
- the stop date for the copyright, may be null. May not be specified if start is not specified.owner
- the owner of the copyright. may be null.
-
CopyrightMatcher
Constructs the CopyrightMatcher with the specified start, stop and owner strings.- Parameters:
id
- the id for the matcher.start
- the start date for the copyright may be null.stop
- the stop date for the copyright, may be null. May not be specified if start is not specified.owner
- the owner of the copyright. may be null.
-
-
Method Details
-
doMatch
Description copied from class:AbstractSimpleMatcher
Performs the actual match test.- Specified by:
doMatch
in classAbstractSimpleMatcher
- Parameters:
line
- the line to check.- Returns:
true
if the line matches,false
otherwise.
-