org.apache.rat.analysis.license
Class CopyrightHeader
java.lang.Object
org.apache.rat.analysis.license.BaseLicense
org.apache.rat.analysis.license.CopyrightHeader
- All Implemented Interfaces:
- IHeaderMatcher
- Direct Known Subclasses:
- AppliedApacheSoftwareLicense20
public class CopyrightHeader
- extends BaseLicense
- implements 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"
- * Copyright 2010 FooBar. *
- * Copyright 2010-2012 FooBar. *
- *copyright 2012 foobar*
Note also that the copyright owner is appended to the regex pattern, so
can support additional regex but also requires escaping where needed,
e.g. use "FooBar \(www\.foobar\.com\)" for matching "FooBar (www.foobar.com)"
- Since:
- Rat 0.9
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
COPYRIGHT_PREFIX_PATTERN_DEFN
public static final String COPYRIGHT_PREFIX_PATTERN_DEFN
- See Also:
- Constant Field Values
CopyrightHeader
public CopyrightHeader()
CopyrightHeader
protected CopyrightHeader(MetaData.Datum licenseFamilyCategory,
MetaData.Datum licenseFamilyName,
String notes)
CopyrightHeader
protected CopyrightHeader(MetaData.Datum licenseFamilyCategory,
MetaData.Datum licenseFamilyName,
String notes,
String copyrightOwner)
setCopyrightOwner
public void setCopyrightOwner(String copyrightOwner)
getCopyRightOwner
public String getCopyRightOwner()
hasCopyrightPattern
public boolean hasCopyrightPattern()
isCopyrightMatch
protected boolean isCopyrightMatch()
matchCopyright
protected boolean matchCopyright(String s)
throws RatHeaderAnalysisException
- Throws:
RatHeaderAnalysisException
match
public boolean match(Document subject,
String s)
throws RatHeaderAnalysisException
- Description copied from interface:
IHeaderMatcher
- Matches the text accumulated to licenses.
TODO probably a poor design choice - hope to fix later
- Specified by:
match
in interface IHeaderMatcher
- Parameters:
subject
- TODOs
- next line of text, not null
- Returns:
- TODO
- Throws:
RatHeaderAnalysisException
reset
public void reset()
- Description copied from interface:
IHeaderMatcher
- Resets this matches.
Subsequent calls to
IHeaderMatcher.match(org.apache.rat.api.Document, java.lang.String)
will accumulate new text.
- Specified by:
reset
in interface IHeaderMatcher
Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.