public class JavaDeclarationProvider extends java.lang.Object implements IdDeclarationProvider
Constructor and Description |
---|
JavaDeclarationProvider() |
Modifier and Type | Method and Description |
---|---|
boolean |
canGetDeclaration(Context context)
Determine whether there could be a declaration in the context.
|
boolean |
canGetDeclaration(Context context,
java.lang.String id)
Determine whether this provider can supply the declaration for an ID.
|
boolean |
canGetDeclarations(Context context,
Node node)
Determine whether this provider can get declarations for a Node.
|
static java.lang.String |
getAnnotationId(java.lang.String fqClassName)
Get the declaration ID for a Java annotation.
|
static java.lang.String |
getAnnotationName(java.lang.String id)
Get the fully qualified Java class name for an annotation ID.
|
static java.lang.String |
getClassId(java.lang.String fqClassName)
Get the declaration ID for a Java class.
|
static java.lang.String |
getClassName(java.lang.String id)
Get the fully qualified Java class name for a declaration ID.
|
Declaration |
getDeclaration(Context context)
Get the declaration for the given context.
|
IdDeclaration |
getDeclaration(Context context,
java.lang.String id)
Get the declaration corresponding to an ID.
|
java.util.Collection<Declaration> |
getDeclarations(Context context,
Node node)
Get all declarations for a Node.
|
static java.lang.String |
getFieldId(java.lang.String fqClassName,
java.lang.String fieldName)
Get the declaration ID for a Java field.
|
static java.lang.String |
getFieldName(java.lang.String id)
Get the Java field name for a declaration ID.
|
static java.lang.String |
getMethodId(java.lang.String fqClassName,
java.lang.String methodName,
java.lang.String... parameters)
Get the declaration ID for a Java method.
|
static java.lang.String |
getMethodName(java.lang.String id)
Get the Java method name for a declaration ID.
|
static java.lang.String |
getResourceKeyId(java.lang.String fqClassName,
java.lang.String resId)
Get the declaration ID for a Java list resource bundle key.
|
static java.lang.String |
getResourceKeyName(java.lang.String id) |
java.util.Collection<Declaration> |
getTopLevelDeclarations(Context context,
Node node)
Get all top-level declarations for a Node.
|
static boolean |
isAnnotationDeclaration(java.lang.String id)
Determine if a declaration ID is a Java annotation declaration.
|
static boolean |
isClassDeclaration(java.lang.String id)
Determine if a declaration ID is a Java class declaration.
|
static boolean |
isFieldDeclaration(java.lang.String id)
Determine if a declaration ID is a Java field declaration.
|
static boolean |
isJavaDeclaration(java.lang.String id)
Determine if a declaration ID is a Java declaration.
|
static boolean |
isMethodDeclaration(java.lang.String id)
Determine if a declaration ID is a Java method declaration.
|
static boolean |
isResourceKeyDeclaration(java.lang.String id) |
public static java.lang.String getAnnotationId(java.lang.String fqClassName)
fqClassName
- the fully qualified annotation class namepublic static java.lang.String getClassId(java.lang.String fqClassName)
fqClassName
- the fully qualified class namepublic static java.lang.String getFieldId(java.lang.String fqClassName, java.lang.String fieldName)
fqClassName
- the fully qualified class namefieldName
- the field namepublic static java.lang.String getResourceKeyId(java.lang.String fqClassName, java.lang.String resId)
fqClassName
- the fully qualified class nameresId
- the resource key namepublic static java.lang.String getMethodId(java.lang.String fqClassName, java.lang.String methodName, java.lang.String... parameters)
fqClassName
- the fully qualified class namemethodName
- the method nameparameters
- the fully qualified names of the parameter typespublic static java.lang.String getAnnotationName(java.lang.String id)
id
- the declaration IDpublic static java.lang.String getClassName(java.lang.String id)
id
- the declaration IDpublic static java.lang.String getMethodName(java.lang.String id)
id
- the declaration IDpublic static java.lang.String getResourceKeyName(java.lang.String id)
public static java.lang.String getFieldName(java.lang.String id)
id
- the declaration IDpublic static boolean isJavaDeclaration(java.lang.String id)
id
- the declaration IDpublic static boolean isAnnotationDeclaration(java.lang.String id)
id
- the declaration IDpublic static boolean isClassDeclaration(java.lang.String id)
id
- the declaration IDpublic static boolean isMethodDeclaration(java.lang.String id)
id
- the declaration IDpublic static boolean isFieldDeclaration(java.lang.String id)
id
- the declaration IDpublic static boolean isResourceKeyDeclaration(java.lang.String id)
public boolean canGetDeclaration(Context context)
DeclarationProvider
canGetDeclaration
in interface DeclarationProvider
context
- the contextpublic Declaration getDeclaration(Context context)
DeclarationProvider
DeclarationProvider.canGetDeclaration(oracle.ide.Context)
returned true for this context.getDeclaration
in interface DeclarationProvider
context
- the contextpublic boolean canGetDeclarations(Context context, Node node)
DeclarationProvider
canGetDeclarations
in interface DeclarationProvider
context
- the contextnode
- the Nodepublic java.util.Collection<Declaration> getDeclarations(Context context, Node node)
DeclarationProvider
getDeclarations
in interface DeclarationProvider
context
- the contextnode
- the Nodepublic java.util.Collection<Declaration> getTopLevelDeclarations(Context context, Node node)
DeclarationProvider
Some languages have a hierarchy of declarations. Objects further down in
the hierarchy can only be accessed through these top-level declarations.
For example, methods in a Java class can only be referenced directly
through a reference to the Java class. Or columns in a database table
might only be referenced through a reference to the table. In those
cases, it is possible to search for all references to a Node by
searching only for the top-level declarations. This improves performance
compared to searching for every declaration in the Node.
Implementations that do not have such a declaration hierarchy can simply
call DeclarationProvider.getDeclarations(Context,Node)
.
getTopLevelDeclarations
in interface DeclarationProvider
context
- the contextnode
- the Nodepublic boolean canGetDeclaration(Context context, java.lang.String id)
IdDeclarationProvider
true
if they are responsible
for this ID, regardless of whether the declaration actually exists.canGetDeclaration
in interface IdDeclarationProvider
context
- the contextid
- the declaration IDtrue
if the provider can find the declarationpublic IdDeclaration getDeclaration(Context context, java.lang.String id) throws java.lang.InterruptedException
IdDeclarationProvider
getDeclaration
in interface IdDeclarationProvider
context
- the contextid
- the declaration IDnull
if the declaration is not foundjava.lang.InterruptedException
- if the operation is interrupted