|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.android.tools.lint.detector.api.Context
com.android.tools.lint.detector.api.ResourceContext
com.android.tools.lint.detector.api.XmlContext
@Beta public class XmlContext
A Context used when checking XML files.
| Field Summary | |
|---|---|
org.w3c.dom.Document |
document
The XML document |
| Fields inherited from class com.android.tools.lint.detector.api.Context |
|---|
file, mDriver |
| Constructor Summary | |
|---|---|
XmlContext(LintDriver driver,
Project project,
Project main,
java.io.File file,
com.android.resources.ResourceFolderType folderType,
XmlParser parser)
Construct a new XmlContext |
|
| Method Summary | |
|---|---|
Location.Handle |
createLocationHandle(org.w3c.dom.Node node)
|
Location |
getLocation(org.w3c.dom.Node node)
Returns the location for the given node, which may be an element or an attribute. |
Location |
getLocation(org.w3c.dom.Node textNode,
int begin,
int end)
Creates a new location within an XML text node |
Location |
getNameLocation(org.w3c.dom.Node node)
Returns the location for name-portion of the given element or attribute. |
XmlParser |
getParser()
|
protected java.lang.String |
getSuppressCommentPrefix()
Returns the comment marker used in Studio to suppress statements for language, if any |
Location |
getValueLocation(org.w3c.dom.Attr node)
Returns the location for value-portion of the given attribute |
boolean |
isSuppressedWithComment(org.w3c.dom.Node node,
Issue issue)
|
void |
report(Issue issue,
Location location,
java.lang.String message)
Reports an issue. |
void |
report(Issue issue,
org.w3c.dom.Node scope,
Location location,
java.lang.String message)
Reports an issue applicable to a given DOM node. |
void |
report(Issue issue,
org.w3c.dom.Node scope,
Location location,
java.lang.String message,
java.lang.Object data)
Deprecated. Use report(Issue, org.w3c.dom.Node, Location, String) instead;
this method is here for custom rule compatibility |
| Methods inherited from class com.android.tools.lint.detector.api.ResourceContext |
|---|
getFolderVersion, getResourceFolderType |
| Methods inherited from class com.android.tools.lint.detector.api.Context |
|---|
containsCommentSuppress, getClient, getConfiguration, getContents, getDriver, getMainProject, getPhase, getProject, getProperty, getScope, getSdkInfo, isEnabled, isSuppressedWithComment, log, report, requestRepeat, setProperty |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public org.w3c.dom.Document document
| Constructor Detail |
|---|
public XmlContext(@NonNull
LintDriver driver,
@NonNull
Project project,
@Nullable
Project main,
@NonNull
java.io.File file,
@Nullable
com.android.resources.ResourceFolderType folderType,
@NonNull
XmlParser parser)
XmlContext
driver - the driver running through the checksproject - the project containing the file being checkedmain - the main project if this project is a library project, or
null if this is not a library project. The main project is
the root project of all library projects, not necessarily the
directly including project.file - the file being checkedfolderType - the ResourceFolderType of this file, if any| Method Detail |
|---|
@NonNull
public Location getLocation(@NonNull
org.w3c.dom.Node node)
node - the node to look up the location for
@NonNull
public Location getNameLocation(@NonNull
org.w3c.dom.Node node)
node - the node to look up the location for
@NonNull
public Location getValueLocation(@NonNull
org.w3c.dom.Attr node)
node - the node to look up the location for
@NonNull
public Location getLocation(@NonNull
org.w3c.dom.Node textNode,
int begin,
int end)
textNode - the text nodebegin - the start offset within the text node (inclusive)end - the end offset within the text node (exclusive)
@NonNull public XmlParser getParser()
public void report(@NonNull
Issue issue,
@Nullable
org.w3c.dom.Node scope,
@Nullable
Location location,
@NonNull
java.lang.String message)
issue - the issue to reportscope - the DOM node scope the error applies to. The lint infrastructure
will check whether there are suppress directives on this node (or its enclosing
nodes) and if so suppress the warning without involving the client.location - the location of the issue, or null if not knownmessage - the message for this warning
@Deprecated
public void report(@NonNull
Issue issue,
@Nullable
org.w3c.dom.Node scope,
@Nullable
Location location,
@NonNull
java.lang.String message,
@Nullable
java.lang.Object data)
report(Issue, org.w3c.dom.Node, Location, String) instead;
this method is here for custom rule compatibility
report(Issue, org.w3c.dom.Node, Location, String) but with
a now-unused data parameter at the end.
public void report(@NonNull
Issue issue,
@Nullable
Location location,
@NonNull
java.lang.String message)
ContextLintClient.report(com.android.tools.lint.detector.api.Context, com.android.tools.lint.detector.api.Issue, com.android.tools.lint.detector.api.Severity, com.android.tools.lint.detector.api.Location, java.lang.String, com.android.tools.lint.detector.api.TextFormat)
report in class Contextissue - the issue to reportlocation - the location of the issue, or null if not knownmessage - the message for this warning@Nullable protected java.lang.String getSuppressCommentPrefix()
Context
getSuppressCommentPrefix in class Context
public boolean isSuppressedWithComment(@NonNull
org.w3c.dom.Node node,
@NonNull
Issue issue)
@NonNull
public Location.Handle createLocationHandle(@NonNull
org.w3c.dom.Node node)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||