public interface IDefinition
A definition is something in source code that can be referred to by name: a package, namespace, class, interface, function, getter, setter, parameter, variable, constant, event, style, or effect.
Each definition has
public;static
or override;null
for some types of definitions.
Definitions refer to other definitions indirectly, by name,
using an IReference. See the references
subpackage for an explanation of this design.
| Modifier and Type | Method and Description |
|---|---|
int |
getAbsoluteEnd()
Gets the absolute ending offset of the entire definition (not just the
name).
|
int |
getAbsoluteStart()
Gets the absolute starting offset of the entire definition (not just the
name).
|
IMetaTag[] |
getAllMetaTags()
Returns all the
IMetaTagNode objects as an array |
IDefinition |
getAncestorOfType(Class<? extends IDefinition> ancestorType)
Gets an ancestor definition of this definition.
|
String |
getBaseName()
Gets the base (i.e., unqualified) name of this definition.
|
List<String> |
getBindableEventNames() |
int |
getColumn()
Gets the local column number of the entire definition (not just the
name).
|
String |
getContainingFilePath()
Gets the file path in which this definition is defined.
|
IASScope |
getContainingScope()
Gets the scope in which this definition exists.
|
String |
getContainingSourceFilePath(ICompilerProject project)
Gets the source file path in which this definition is defined.
|
IDeprecationInfo |
getDeprecationInfo()
Gets the information in the definition's
[Deprecated] metadata. |
int |
getEnd()
Gets the local ending offset of this entire definition (not just the
name).
|
int |
getLine()
Gets the local line number of this entire definition (not just the name).
|
IMetaTag |
getMetaTagByName(String name)
Returns the first
IMetaTagNode matching the given name |
IMetaTag[] |
getMetaTagsByName(String name)
Gets all the
IMetaTagNode objects that match the given name |
ModifiersSet |
getModifiers() |
int |
getNameColumn()
Gets the local column number of the name of this definition.
|
int |
getNameEnd()
Gets the local ending offset of the name of this definition.
|
int |
getNameLine()
Gets the local line number of the name of this definition.
|
INamespaceReference |
getNamespaceReference()
Gets the namespace that this definition belongs to.
|
int |
getNameStart()
Gets the local starting offset of the name of this definition.
|
IDefinitionNode |
getNode()
Returns the
IDefinitionNode from which this definition was
created, if the definition came from the AST for a source file. |
String |
getPackageName()
Gets the fully-qualified package name for this definition.
|
IDefinition |
getParent()
Gets the parent definition of this definition.
|
String |
getQualifiedName()
Gets the fully-qualified name of this definition.
|
String |
getSourcePath()
Gets the local source path of the entire definition (not just the name).
|
int |
getStart()
Gets the local starting offset of the entire definition (not just the
name).
|
String |
getTypeAsDisplayString()
Converts this definition's type reference to a human-readable String.
|
IReference |
getTypeReference()
Gets a reference to the type of this definition.
|
boolean |
hasMetaTagByName(String name)
Determines if a specific
IMetaTagNode exists in this collection |
boolean |
hasModifier(ASModifier modifier)
Determines whether the specified modifier is present on this definition.
|
boolean |
hasNamespace(INamespaceReference namespace,
ICompilerProject project)
Determines whether the specified namespace is present on this definition.
|
boolean |
isBindable()
Whether this definition was specified as "Bindable" in its metadata
|
boolean |
isBindableStyle() |
boolean |
isContingent() |
boolean |
isContingentNeeded(ICompilerProject project)
Check if the contingent definition is needed
|
boolean |
isDeprecated()
Checks if this definition is deprecated.
|
boolean |
isDynamic()
Is this definition marked as
dynamic? |
boolean |
isFinal()
Is this definition marked as
final? |
boolean |
isGeneratedEmbedClass() |
boolean |
isImplicit()
Is this definition an implicit definition that doesn't actually appear in
the source file?
|
boolean |
isInProject(ICompilerProject project)
Debugging method that can be used to assert that a definition is a specified project.
|
boolean |
isInternal()
Determines whether this definition is in an internal namespace.
|
boolean |
isNative()
Is this definition marked as
native? |
boolean |
isOverride()
Is this definition marked as
override? |
boolean |
isPrivate()
Determines whether this definition is in a private namespace.
|
boolean |
isProtected()
Determines whether this definition is in a protected namespace.
|
boolean |
isPublic()
Determines whether this definition is in a public namespace.
|
boolean |
isStatic()
Is this definition marked as
static? |
INamespaceDefinition |
resolveNamespace(ICompilerProject project)
Resolves the namespace specified for this definition to its
INamespaceDefinition.
|
ITypeDefinition |
resolveType(ICompilerProject project)
Resolves the type of this definition to an
ITypeDefinition. |
String getSourcePath()
String for the path.int getStart()
int for the offset.int getEnd()
int for the offset.int getLine()
int for the line number.int getColumn()
int for the column number.int getAbsoluteStart()
int for the offset.int getAbsoluteEnd()
int for the offset.String getBaseName()
For example, the base name of the class definition
for the class flash.display.Sprite
is "Sprite".
String getPackageName()
For example, the backage name of the class definition
for the class flash.display.Sprite
is "flash.display"
String getQualifiedName()
For example, the fully-qualified name of the class definition
for the class flash.display.Sprite is
"flash.display.Sprite".
int getNameStart()
int for the offset.int getNameEnd()
int for the offset.int getNameLine()
int for the line number.int getNameColumn()
int for the column number.IASScope getContainingScope()
null if
this definition has not yet been added to a scope.IDefinition getParent()
null if there is
no parent.IDefinition getAncestorOfType(Class<? extends IDefinition> ancestorType)
This method walks up the chain of parent definitions and returns the first one having the specified type.
ancestorType - A Class specifying the desired type of ancestor.String getContainingFilePath()
String getContainingSourceFilePath(ICompilerProject project)
For definitions from a source file (like *.as), the result is the same as
getContainingFilePath().
If the definition is from a SWC library, and the library source path was set, the result is the file path in the source directory. If the source path was not set, the result is null.
project - the containing projectboolean isDynamic()
dynamic?true if the definition is dynamic.boolean isFinal()
final?true if the definition is final.boolean isNative()
native?true if the definition is native.boolean isOverride()
override?true if the definition is override.boolean isStatic()
static?true if the definition is static.boolean hasModifier(ASModifier modifier)
ASModifier for the list of modifiers.true if the modifier is present.ModifiersSet getModifiers()
boolean hasNamespace(INamespaceReference namespace, ICompilerProject project)
Namespaces include public, private,
protected, and internal, plus any custom
namespaces available in the definition's scope.
The namespace is specified by an INamespaceReference, which can represent
not only a custom namespace like ns1 but also
ns1::ns2, (ns1::ns2)::ns3, etc.
namespace - An INamespaceReference specifying the namespace to check
for.true if the namespace is present.INamespaceReference getNamespaceReference()
== NamespaceDefinition.getPublic(),
instanceof IPublicNamespaceDefinition,
instanceof IProtectedNamespaceDefinition, or For a custom
namespace, the INamespaceReference will represent an expression of the
form ns1, ns1::ns2,
(ns1::ns2)::ns3, etc.INamespaceDefinition resolveNamespace(ICompilerProject project)
null.INamespaceDefinition or null.boolean isPublic()
true if it is.boolean isPrivate()
true if it is.boolean isProtected()
true if it is.boolean isInternal()
true if it is.IReference getTypeReference()
For a constant, variable, parameter, getter, or setter definition,
the type reference is determined by the type annotation.
For example, for a variable declaration like var i:int,
the type reference is a reference to the int class.
(For a setter, the relevant type annotation is on the parameter,
not the return type, which is supposed to be void.)
If the type annotation is missing, the reference is null.
For a function definition, the type reference is always
to the Function class. You must use the
getReturnTypeReference() method of
FunctionDefinition to get the function's return type.
For a rest parameter, the type reference is always
to the Array class.
For a package, class, or interface definition,
the type reference is null.
For style and event definitions, the type reference
is determined by the type attribute in the metadata.
IReference to a class or interface.ITypeDefinition resolveType(ICompilerProject project)
ITypeDefinition.project - The ICompilerProject within which references are
to be resolved.ITypeDefinition or nullString getTypeAsDisplayString()
If the definition does not have a type reference, this method returns the empty string.
This method should only be used for displaying types in problems, and not for making semantic decisions.
IReference.getDisplayString()()
on the IReference returned by getTypeReference()().boolean isImplicit()
this, super,
default constructors, and cast functions.IMetaTag[] getMetaTagsByName(String name)
IMetaTagNode objects that match the given namename - the name to match, such as Event, Style, IconFile, etcIMetaTagNode objects, or empty array (never
null)IMetaTag[] getAllMetaTags()
IMetaTagNode objects as an arrayboolean hasMetaTagByName(String name)
IMetaTagNode exists in this collectionname - the name of the tagIMetaTag getMetaTagByName(String name)
IMetaTagNode matching the given namename - the name to search forIMetaTagNode or nullIDefinitionNode getNode()
IDefinitionNode from which this definition was
created, if the definition came from the AST for a source file.
This method may require the AST to be reloaded or regenerated and therefore may be slow.
More specific definition interfaces such as IClassDefinition
redeclare this method to return a more specific node interface such as
IClassNode.
boolean isBindable()
List<String> getBindableEventNames()
boolean isBindableStyle()
boolean isContingent()
boolean isGeneratedEmbedClass()
true if this definition is for an auto-generated
embed class (i.e., one created for a var with
[Embed(...)] metadata).boolean isContingentNeeded(ICompilerProject project)
project - boolean isDeprecated()
true if it has [Deprecated] metadata.IDeprecationInfo getDeprecationInfo()
[Deprecated] metadata.IDeprecationInfo object.boolean isInProject(ICompilerProject project)
project - Copyright © 2016 The Apache Software Foundation. All rights reserved.