com.android.tools.lint.client.api
Interface IJavaParser


public interface IJavaParser

A wrapper for a Java parser. This allows tools integrating lint to map directly to builtin services, such as already-parsed data structures in Java editors.

NOTE: This is not a or final API; if you rely on this be prepared to adjust your code for the next tools release.


Method Summary
 Location.Handle createLocationHandle(JavaContext context, lombok.ast.Node node)
          Creates a light-weight handle to a location for the given node.
 void dispose(JavaContext context, lombok.ast.Node compilationUnit)
          Dispose any data structures held for the given context.
 Location getLocation(JavaContext context, lombok.ast.Node node)
          Returns a Location for the given node
 lombok.ast.TypeReference getType(JavaContext context, lombok.ast.Node node)
          Gets the type of the given node
 lombok.ast.Node parseJava(JavaContext context)
          Parse the file pointed to by the given context.
 lombok.ast.Node resolve(JavaContext context, lombok.ast.Node node)
          Resolves the given expression node
 

Method Detail

parseJava

@Nullable
lombok.ast.Node parseJava(@NonNull
                                   JavaContext context)
Parse the file pointed to by the given context.

Parameters:
context - the context pointing to the file to be parsed, typically via Context.getContents() but the file handle ( Context.file can also be used to map to an existing editor buffer in the surrounding tool, etc)
Returns:
the compilation unit node for the file

getLocation

@NonNull
Location getLocation(@NonNull
                             JavaContext context,
                             @NonNull
                             lombok.ast.Node node)
Returns a Location for the given node

Parameters:
context - information about the file being parsed
node - the node to create a location for
Returns:
a location for the given node

createLocationHandle

@NonNull
Location.Handle createLocationHandle(@NonNull
                                             JavaContext context,
                                             @NonNull
                                             lombok.ast.Node node)
Creates a light-weight handle to a location for the given node. It can be turned into a full fledged location by Location.Handle.resolve().

Parameters:
context - the context providing the node
node - the node (element or attribute) to create a location handle for
Returns:
a location handle

dispose

void dispose(@NonNull
             JavaContext context,
             @NonNull
             lombok.ast.Node compilationUnit)
Dispose any data structures held for the given context.

Parameters:
context - information about the file previously parsed
compilationUnit - the compilation unit being disposed

resolve

@Nullable
lombok.ast.Node resolve(@NonNull
                                 JavaContext context,
                                 @NonNull
                                 lombok.ast.Node node)
Resolves the given expression node

Parameters:
context - information about the file being parsed
node - the node to resolve
Returns:
a node representing the resolved fully type, class, field or method

getType

@Nullable
lombok.ast.TypeReference getType(@NonNull
                                          JavaContext context,
                                          @NonNull
                                          lombok.ast.Node node)
Gets the type of the given node

Parameters:
context - information about the file being parsed
node - the node to look up the type for
Returns:
the type of the node, if known