net.sourceforge.pmd

Class RuleContext

public class RuleContext extends Object

BSD-style license; for more info see http://pmd.sourceforge.net/license.html
Constructor Summary
RuleContext()
Default constructor.
RuleContext(RuleContext ruleContext)
Constructor which shares attributes with the given RuleContext.
Method Summary
voidexcludeLines(Map<Integer,String> lines)
ObjectgetAttribute(String name)
Get an attribute value on the RuleContext.
ReportgetReport()
FilegetSourceCodeFile()
StringgetSourceCodeFilename()
SourceTypegetSourceType()
ObjectremoveAttribute(String name)
Remove an attribute value on the RuleContext.
booleansetAttribute(String name, Object value)
Set an attribute value on the RuleContext, if it does not already exist.
voidsetReport(Report report)
voidsetSourceCodeFile(File sourceCodeFile)
voidsetSourceCodeFilename(String filename)
voidsetSourceType(SourceType t)

Constructor Detail

RuleContext

public RuleContext()
Default constructor.

RuleContext

public RuleContext(RuleContext ruleContext)
Constructor which shares attributes with the given RuleContext.

Method Detail

excludeLines

public void excludeLines(Map<Integer,String> lines)

getAttribute

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.

Parameters: name The attribute name.

Returns: The current attribute value, or null if the attribute does not exist.

getReport

public Report getReport()

getSourceCodeFile

public File getSourceCodeFile()

getSourceCodeFilename

public String getSourceCodeFilename()

getSourceType

public SourceType getSourceType()

removeAttribute

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.

Parameters: name The attribute name.

Returns: The current attribute value, or null if the attribute does not exist.

setAttribute

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.

Parameters: name The attribute name. value The attribute value.

Returns: true if the attribute was set, false otherwise.

Throws: IllegalArgumentException if name or value are null

setReport

public void setReport(Report report)

setSourceCodeFile

public void setSourceCodeFile(File sourceCodeFile)

setSourceCodeFilename

public void setSourceCodeFilename(String filename)

setSourceType

public void setSourceType(SourceType t)