public abstract static class ImportRewrite.ImportRewriteContext extends Object
ImportRewrite.ImportRewriteContext
can optionally be used in e.g. ImportRewrite.addImport(String, ImportRewrite.ImportRewriteContext)
to
give more information about the types visible in the scope. These types can be for example inherited inner types where it is
unnecessary to add import statements for.
This class can be implemented by clients.
Modifier and Type | Field and Description |
---|---|
static int |
KIND_STATIC_FIELD
Kind constant specifying that the element is a static field import.
|
static int |
KIND_STATIC_METHOD
Kind constant specifying that the element is a static method import.
|
static int |
KIND_TYPE
Kind constant specifying that the element is a type import.
|
static int |
RES_NAME_CONFLICT
Result constant signaling that the given element is conflicting with an other element in the context.
|
static int |
RES_NAME_FOUND
Result constant signaling that the given element is know in the context.
|
static int |
RES_NAME_UNKNOWN
Result constant signaling that the given element is not know in the context.
|
static int |
RES_NAME_UNKNOWN_NEEDS_EXPLICIT_IMPORT
Result constant signaling that the given element must be imported explicitly (and must not be folded into
an on-demand import or filtered as an implicit import).
|
Constructor and Description |
---|
ImportRewriteContext() |
Modifier and Type | Method and Description |
---|---|
abstract int |
findInContext(String qualifier,
String name,
int kind)
Searches for the given element in the context and reports if the element is known (
RES_NAME_FOUND ),
unknown (RES_NAME_UNKNOWN ), unknown in the context but known to require an explicit import
(RES_NAME_UNKNOWN_NEEDS_EXPLICIT_IMPORT ), or if its name conflicts (RES_NAME_CONFLICT )
with an other element. |
public static final int RES_NAME_FOUND
public static final int RES_NAME_UNKNOWN
public static final int RES_NAME_CONFLICT
public static final int RES_NAME_UNKNOWN_NEEDS_EXPLICIT_IMPORT
public static final int KIND_TYPE
public static final int KIND_STATIC_FIELD
public static final int KIND_STATIC_METHOD
public abstract int findInContext(String qualifier, String name, int kind)
RES_NAME_FOUND
),
unknown (RES_NAME_UNKNOWN
), unknown in the context but known to require an explicit import
(RES_NAME_UNKNOWN_NEEDS_EXPLICIT_IMPORT
), or if its name conflicts (RES_NAME_CONFLICT
)
with an other element.qualifier
- The qualifier of the element, can be package or the qualified name of a typename
- The simple name of the element; either a type, method or field name or * for on-demand imports.kind
- The kind of the element. Can be either KIND_TYPE
, KIND_STATIC_FIELD
or
KIND_STATIC_METHOD
. Implementors should be prepared for new, currently unspecified kinds and return
RES_NAME_UNKNOWN
by default.RES_NAME_FOUND
, RES_NAME_UNKNOWN
,
RES_NAME_CONFLICT
, or RES_NAME_UNKNOWN_NEEDS_EXPLICIT_IMPORT
.
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.