|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.android.tools.lint.detector.api.Location
@Beta public class Location
Location information for a warning
NOTE: This is not a public or final API; if you rely on this be prepared to adjust your code for the next tools release.
| Nested Class Summary | |
|---|---|
static class |
Location.DefaultLocationHandle
A default Location.Handle implementation for simple file offsets |
static interface |
Location.Handle
A Location.Handle is a reference to a location. |
static class |
Location.ResourceItemHandle
|
static class |
Location.SearchDirection
Whether to look forwards, or backwards, or in both directions, when searching for a pattern in the source code to determine the right position range for a given symbol. |
static class |
Location.SearchHints
Extra information pertaining to finding a symbol in a source buffer, used by create(File, String, int, String, String, SearchHints) |
| Constructor Summary | |
|---|---|
protected |
Location(java.io.File file,
Position start,
Position end)
(Private constructor, use one of the factory methods create(File),
create(File, Position, Position), or
create(File, String, int, int). |
| Method Summary | |
|---|---|
static Location |
create(java.io.File file)
Creates a new location for the given file |
static Location |
create(java.io.File file,
Position start,
Position end)
Creates a new location for the given file and starting and ending positions. |
static Location |
create(java.io.File file,
java.lang.String contents,
int line)
Creates a new location for the given file, with the given contents, for the given line number. |
static Location |
create(java.io.File file,
java.lang.String contents,
int startOffset,
int endOffset)
Creates a new location for the given file, with the given contents, for the given offset range. |
static Location |
create(java.io.File file,
java.lang.String contents,
int line,
java.lang.String patternStart,
java.lang.String patternEnd,
Location.SearchHints hints)
Creates a new location for the given file, with the given contents, for the given line number. |
java.lang.Object |
getClientData()
Returns the client data associated with this location - an optional field which can be used by the creator of the Location to store
temporary state associated with the location. |
Position |
getEnd()
The end position of the range |
java.io.File |
getFile()
Returns the file containing the warning. |
java.lang.String |
getMessage()
Returns the custom message for this location, if any. |
Location |
getSecondary()
Returns a secondary location associated with this location (if applicable), or null. |
Position |
getStart()
The start position of the range |
static Location |
reverse(Location location)
Reverses the secondary location list initiated by the given location |
void |
setClientData(java.lang.Object clientData)
Sets the client data associated with this location. |
void |
setMessage(java.lang.String message)
Sets a custom message for this location. |
void |
setSecondary(Location secondary)
Sets a secondary location for this location. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected Location(@NonNull
java.io.File file,
@Nullable
Position start,
@Nullable
Position end)
create(File),
create(File, Position, Position), or
create(File, String, int, int).
Constructs a new location range for the given file, from start to end. If the length of the range is not known, end may be null.
file - the associated file (but see the documentation for
getFile() for more information on what the file
represents)start - the starting position, or nullend - the ending position, or null| Method Detail |
|---|
@NonNull public java.io.File getFile()
@Nullable public Position getStart()
@Nullable public Position getEnd()
@Nullable public Location getSecondary()
public void setSecondary(@Nullable
Location secondary)
secondary - a secondary location associated with this location
public void setMessage(@NonNull
java.lang.String message)
message - the message to apply to this location@Nullable public java.lang.String getMessage()
public void setClientData(@Nullable
java.lang.Object clientData)
Location to store
temporary state associated with the location.
clientData - the data to store with this location@Nullable public java.lang.Object getClientData()
Location to store
temporary state associated with the location.
public java.lang.String toString()
toString in class java.lang.Object
@NonNull
public static Location create(@NonNull
java.io.File file)
file - the file to create a location for
@NonNull
public static Location create(@NonNull
java.io.File file,
@NonNull
Position start,
@Nullable
Position end)
file - the file containing the positionsstart - the starting positionend - the ending position
@NonNull
public static Location create(@NonNull
java.io.File file,
@Nullable
java.lang.String contents,
int startOffset,
int endOffset)
file - the file containing the locationcontents - the current contents of the filestartOffset - the starting offsetendOffset - the ending offset
@NonNull
public static Location create(@NonNull
java.io.File file,
@NonNull
java.lang.String contents,
int line)
file - the file containing the locationcontents - the current contents of the fileline - the line number (0-based) for the position
@NonNull
public static Location create(@NonNull
java.io.File file,
@NonNull
java.lang.String contents,
int line,
@Nullable
java.lang.String patternStart,
@Nullable
java.lang.String patternEnd,
@Nullable
Location.SearchHints hints)
file - the file containing the locationcontents - the current contents of the fileline - the line number (0-based) for the positionpatternStart - an optional pattern to search for from the line
match; if found, adjust the column and offsets to begin at the
pattern startpatternEnd - an optional pattern to search for behind the start
pattern; if found, adjust the end offset to match the end of
the patternhints - optional additional information regarding the pattern search
public static Location reverse(@NonNull
Location location)
location - the first location in the list
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||