public abstract class AbstractHeaderCheck extends AbstractFileSetCheck implements ExternalResourceHolder
AutomaticBean.OutputStreamOptions| Modifier and Type | Field and Description |
|---|---|
private java.nio.charset.Charset |
charset
Specify the character encoding to use when reading the headerFile.
|
private static java.util.regex.Pattern |
ESCAPED_LINE_FEED_PATTERN
Pattern to detect occurrences of '\n' in text.
|
private java.net.URI |
headerFile
Specify the name of the file containing the required header.
|
private java.util.List<java.lang.String> |
readerLines
The lines of the header file.
|
| Constructor and Description |
|---|
AbstractHeaderCheck() |
| Modifier and Type | Method and Description |
|---|---|
private void |
checkHeaderNotInitialized()
Called before initializing the header.
|
private static java.nio.charset.Charset |
createCharset(java.lang.String name)
Creates charset by name.
|
protected void |
finishLocalSetup()
Provides a hook to finish the part of this component's setup that
was not handled by the bean introspection.
|
java.util.Set<java.lang.String> |
getExternalResourceLocations()
Returns a set of external configuration resource locations which are used by the module.
|
protected java.util.List<java.lang.String> |
getHeaderLines()
Return the header lines to check against.
|
private void |
loadHeader(java.io.Reader headerReader)
Load header to check against from a Reader into readerLines.
|
private void |
loadHeaderFile()
Load the header from a file.
|
protected abstract void |
postProcessHeaderLines()
Hook method for post processing header lines.
|
void |
setCharset(java.lang.String charset)
Setter to specify the charset to use when reading the headerFile.
|
void |
setHeader(java.lang.String header)
Set the header to check against.
|
void |
setHeaderFile(java.net.URI uri)
Setter to specify the name of the file containing the required header..
|
addViolations, beginProcessing, destroy, finishProcessing, fireErrors, getFileContents, getFileExtensions, getMessageDispatcher, getTabWidth, getViolations, init, log, log, process, processFiltered, setFileContents, setFileExtensions, setMessageDispatcher, setTabWidthgetCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityconfigure, contextualize, getConfiguration, setupChildclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconfigurecontextualizeprivate static final java.util.regex.Pattern ESCAPED_LINE_FEED_PATTERN
private final java.util.List<java.lang.String> readerLines
private java.net.URI headerFile
private java.nio.charset.Charset charset
public AbstractHeaderCheck()
protected abstract void postProcessHeaderLines()
protected java.util.List<java.lang.String> getHeaderLines()
public void setCharset(java.lang.String charset)
charset - the charset name to use for loading the header from a filepublic void setHeaderFile(java.net.URI uri) throws CheckstyleException
uri - the uri of the header to load.CheckstyleException - if fileName is empty.private void loadHeaderFile() throws CheckstyleException
CheckstyleException - if the file cannot be loadedprivate void checkHeaderNotInitialized()
java.lang.IllegalArgumentException - if header has already been setprivate static java.nio.charset.Charset createCharset(java.lang.String name)
name - charset namejava.nio.charset.UnsupportedCharsetException - if charset is unsupportedpublic void setHeader(java.lang.String header)
header - header content to check against.java.lang.IllegalArgumentException - if the header cannot be interpretedprivate void loadHeader(java.io.Reader headerReader) throws java.io.IOException
headerReader - delivers the header to check againstjava.io.IOException - ifprotected final void finishLocalSetup() throws CheckstyleException
AutomaticBeanThe default implementation does nothing.
finishLocalSetup in class AbstractViolationReporterCheckstyleException - if there is a configuration error.public java.util.Set<java.lang.String> getExternalResourceLocations()
ExternalResourceHolderNullPointerException in Checker.
Such behaviour will signal that your module (check or filter) is designed incorrectly.
It make sense to return an empty set from 'getExternalResourceLocations()'
only for composite modules like TreeWalker.getExternalResourceLocations in interface ExternalResourceHolderCopyright © 2001-2022. All Rights Reserved.