@Deprecated @InternalApi public RuleContext()
Default constructor.
@Deprecated @InternalApi public RuleContext(RuleContext ruleContext)
Constructor which shares attributes and report listeners with the given RuleContext.
ruleContext
- the context from which the values are shared
@InternalApi @Deprecated public Rule getCurrentRule()
@InternalApi @Deprecated public void setCurrentRule(Rule currentRule)
public void addViolation(Node location)
Record a new violation of the contextual rule, at the given node.
location
- Location of the violation
public void addViolation(Node location, Object... formatArgs)
Record a new violation of the contextual rule, at the given node. The default violation message (
Rule.getMessage()
) is formatted using the given format arguments.
location
- Location of the violation
formatArgs
- Format arguments for the message
MessageFormat
public void addViolationWithMessage(Node location, String message)
Record a new violation of the contextual rule, at the given node. The given violation message (
Rule.getMessage()
) is treated as a format string for a
MessageFormat
and should hence use appropriate escapes. No formatting arguments are provided.
location
- Location of the violation
message
- Violation message
public void addViolationWithMessage(Node location, String message, Object... formatArgs)
Record a new violation of the contextual rule, at the given node. The given violation message (
Rule.getMessage()
) is treated as a format string for a
MessageFormat
and should hence use appropriate escapes. The given formatting arguments are used.
location
- Location of the violation
message
- Violation message
formatArgs
- Format arguments for the message
public void addViolationWithPosition(Node location, int beginLine, int endLine, String message, Object... formatArgs)
Record a new violation of the contextual rule, at the given node. The position is refined using the given begin and end line numbers. The given violation message (
Rule.getMessage()
) is treated as a format string for a
MessageFormat
and should hence use appropriate escapes. The given formatting arguments are used.
location
- Location of the violation
message
- Violation message
formatArgs
- Format arguments for the message
@Deprecated @InternalApi public Report getReport()
Get the Report to which Rule Violations are sent.
@Deprecated @InternalApi public void setReport(Report report)
Set the Report to which Rule Violations are sent.
report
- The Report.
@Deprecated @InternalApi public File getSourceCodeFile()
Get the File associated with the current source file.
@Deprecated @InternalApi public void setSourceCodeFile(File sourceCodeFile)
Set the File associated with the current source file. While this may be set to null
, the exclude/include facilities will not work properly without a File.
sourceCodeFile
- The File.
@Deprecated @InternalApi public String getSourceCodeFilename()
Get the file name associated with the current source file. If there is no source file, then an empty string is returned.
@Deprecated @InternalApi public void setSourceCodeFilename(String filename)
Set the file name associated with the current source file.
filename
- The file name.
@Deprecated public LanguageVersion getLanguageVersion()
Get the LanguageVersion associated with the current source file.
null
if unknown.
@Deprecated @InternalApi public void setLanguageVersion(LanguageVersion languageVersion)
Set the LanguageVersion associated with the current source file. This may be set to null
to indicate the version is unknown and should be automatically determined.
languageVersion
- The LanguageVersion.
@Deprecated public boolean setAttribute(String name, Object value)
Set an attribute value on the RuleContext, if it does not already exist.
Attributes can be shared between RuleContext instances. This operation is thread-safe.
Attribute values should be modified directly via the reference provided. It is not necessary to call setAttribute(String, Object)
to update an attribute value. Modifications made to the attribute value will automatically be seen by other threads. Because of this, you must ensure the attribute values are themselves thread safe.
name
- The attribute name.
value
- The attribute value.
true
if the attribute was set, false
otherwise.
IllegalArgumentException
- if name
or value
are null
@Deprecated public Object getAttribute(String name)
Get an attribute value on the RuleContext.
Attributes can be shared between RuleContext instances. This operation is thread-safe.
Attribute values should be modified directly via the reference provided. It is not necessary to call setAttribute(String, Object)
to update an attribute value. Modifications made to the attribute value will automatically be seen by other threads. Because of this, you must ensure the attribute values are themselves thread safe.
name
- The attribute name.
null
if the attribute does not exist.
@Deprecated public Object removeAttribute(String name)
Remove an attribute value on the RuleContext.
Attributes can be shared between RuleContext instances. This operation is thread-safe.
Attribute values should be modified directly via the reference provided. It is not necessary to call setAttribute(String, Object)
to update an attribute value. Modifications made to the attribute value will automatically be seen by other threads. Because of this, you must ensure the attribute values are themselves thread safe.
name
- The attribute name.
null
if the attribute does not exist.
@Deprecated @InternalApi public void setIgnoreExceptions(boolean ignoreExceptions)
Configure whether exceptions during applying a rule should be ignored or not. If set to true
then such exceptions are logged as warnings and the processing is continued with the next rule - the failing rule is simply skipped. This is the default behavior.
If set to false
then the processing will be aborted with the exception. This is especially useful during unit tests, in order to not oversee any exceptions.
ignoreExceptions
- if true
simply skip failing rules (default).
@Deprecated @InternalApi public boolean isIgnoreExceptions()
Gets the configuration whether to skip failing rules (true
) or whether to throw a a RuntimeException and abort the processing for the first failing rule.
true
when failing rules are skipped, false
otherwise.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4