Klasse LocalVariable

java.lang.Object
org.eclipse.core.runtime.PlatformObject
Alle implementierten Schnittstellen:
IAnnotatable, IJavaElement, ILocalVariable, ISourceReference, org.eclipse.core.runtime.IAdaptable

public class LocalVariable extends SourceRefElement implements ILocalVariable
  • Felddetails

    • NO_LOCAL_VARIABLES

      public static final ILocalVariable[] NO_LOCAL_VARIABLES
    • declarationSourceStart

      public int declarationSourceStart
    • declarationSourceEnd

      public int declarationSourceEnd
    • nameStart

      public int nameStart
    • nameEnd

      public int nameEnd
    • annotations

      public IAnnotation[] annotations
    • annotationsOnDimensions

      public IAnnotation[][] annotationsOnDimensions
  • Konstruktordetails

    • LocalVariable

      public LocalVariable(JavaElement parent, String name, int declarationSourceStart, int declarationSourceEnd, int nameStart, int nameEnd, String typeSignature, Annotation[] astAnnotations, int flags, boolean isParameter)
    • LocalVariable

      public LocalVariable(JavaElement parent, String name, int declarationSourceStart, int declarationSourceEnd, int nameStart, int nameEnd, String typeSignature, Annotation[] astAnnotations, int flags, boolean isParameter, Annotation[][] astAnnotationsOnDimensions)
  • Methodendetails

    • closing

      protected void closing(Object info)
      Beschreibung aus Klasse kopiert: SourceRefElement
      This element is being closed. Do any necessary cleanup.
      Setzt außer Kraft:
      closing in Klasse SourceRefElement
    • createElementInfo

      protected Object createElementInfo()
      Beschreibung aus Klasse kopiert: SourceRefElement
      Returns a new element info for this element.
      Setzt außer Kraft:
      createElementInfo in Klasse SourceRefElement
    • equals

      public boolean equals(Object o)
      Beschreibung aus Klasse kopiert: JavaElement
      Returns true if this handle represents the same Java element as the given handle. By default, two handles represent the same element if they are identical or if they represent the same type of element, have equal names, parents, and occurrence counts.

      If a subclass has other requirements for equality, this method must be overridden.

      Setzt außer Kraft:
      equals in Klasse SourceRefElement
      Siehe auch:
    • exists

      public boolean exists()
      Beschreibung aus Schnittstelle kopiert: IJavaElement
      Returns whether this Java element exists in the model.

      Java elements are handle objects that may or may not be backed by an actual element. Java elements that are backed by an actual element are said to "exist", and this method returns true. For Java elements that are not working copies, it is always the case that if the element exists, then its parent also exists (provided it has one) and includes the element as one of its children. It is therefore possible to navigated to any existing Java element from the root of the Java model along a chain of existing Java elements. On the other hand, working copies are said to exist until they are destroyed (with IWorkingCopy.destroy). Unlike regular Java elements, a working copy never shows up among the children of its parent element (which may or may not exist).

      Angegeben von:
      exists in Schnittstelle IJavaElement
      Angegeben von:
      exists in Schnittstelle ISourceReference
      Setzt außer Kraft:
      exists in Klasse JavaElement
      Gibt zurück:
      true if this element exists in the Java model, and false if this element does not exist
      Siehe auch:
    • generateInfos

      protected void generateInfos(Object info, HashMap newElements, org.eclipse.core.runtime.IProgressMonitor pm)
      Beschreibung aus Klasse kopiert: JavaElement
      Generates the element infos for this element, its ancestors (if they are not opened) and its children (if it is an Openable). Puts the newly created element info in the given map.
      Setzt außer Kraft:
      generateInfos in Klasse SourceRefElement
    • getAnnotation

      public IAnnotation getAnnotation(String annotationName)
      Beschreibung aus Schnittstelle kopiert: IAnnotatable
      Returns the annotation with the given name declared on this element. This is a handle-only method. The annotation may or may not exist.
      Angegeben von:
      getAnnotation in Schnittstelle IAnnotatable
      Setzt außer Kraft:
      getAnnotation in Klasse SourceRefElement
      Parameter:
      annotationName - the given simple name
      Gibt zurück:
      the annotation with the given name declared on this element
    • getAnnotations

      public IAnnotation[] getAnnotations() throws JavaModelException
      Beschreibung aus Schnittstelle kopiert: IAnnotatable
      Returns the annotations for this element. Returns an empty array if this element has no annotations.
      Angegeben von:
      getAnnotations in Schnittstelle IAnnotatable
      Setzt außer Kraft:
      getAnnotations in Klasse SourceRefElement
      Gibt zurück:
      the annotations of this element, in the order declared in the source, or an empty array if none
      Löst aus:
      JavaModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource.
    • getHandleFromMemento

      public IJavaElement getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner owner)
      Setzt außer Kraft:
      getHandleFromMemento in Klasse SourceRefElement
    • getHandleMemento

      protected void getHandleMemento(StringBuffer buff)
      Setzt außer Kraft:
      getHandleMemento in Klasse SourceRefElement
    • getHandleMemento

      protected void getHandleMemento(StringBuffer buff, boolean memoizeParent)
    • getHandleMementoDelimiter

      protected char getHandleMementoDelimiter()
      Beschreibung aus Klasse kopiert: JavaElement
      Returns the char that marks the start of this handles contribution to a memento.
      Angegeben von:
      getHandleMementoDelimiter in Klasse JavaElement
    • getCorrespondingResource

      public org.eclipse.core.resources.IResource getCorrespondingResource()
      Beschreibung aus Klasse kopiert: SourceRefElement
      Elements within compilation units and class files have no corresponding resource.
      Angegeben von:
      getCorrespondingResource in Schnittstelle IJavaElement
      Setzt außer Kraft:
      getCorrespondingResource in Klasse SourceRefElement
      Gibt zurück:
      the corresponding resource, or null if none
      Siehe auch:
    • getDeclaringMember

      public IMember getDeclaringMember()
      Returns the declaring member of this local variable.

      This is a handle-only method.

      Angegeben von:
      getDeclaringMember in Schnittstelle ILocalVariable
      Gibt zurück:
      the declaring member of this local variable
      Seit:
      3.7
    • getElementName

      public String getElementName()
      Beschreibung aus Schnittstelle kopiert: IJavaElement
      Returns the name of this element. This is a handle-only method.
      Angegeben von:
      getElementName in Schnittstelle IJavaElement
      Angegeben von:
      getElementName in Schnittstelle ILocalVariable
      Setzt außer Kraft:
      getElementName in Klasse JavaElement
      Gibt zurück:
      the element name
      Siehe auch:
      • IAdaptable
    • getElementType

      public int getElementType()
      Beschreibung aus Schnittstelle kopiert: IJavaElement
      Returns this element's kind encoded as an integer. This is a handle-only method.
      Angegeben von:
      getElementType in Schnittstelle IJavaElement
      Gibt zurück:
      the kind of element; one of the constants declared in IJavaElement
      Siehe auch:
    • getFlags

      public int getFlags()
      Returns the modifier flags for this local variable. The flags can be examined using class Flags.

      Note that only flags as indicated in the source are returned.

      Angegeben von:
      getFlags in Schnittstelle ILocalVariable
      Gibt zurück:
      the modifier flags for this local variable
      Seit:
      3.7
      Siehe auch:
    • getClassFile

      public ClassFile getClassFile()
      Setzt außer Kraft:
      getClassFile in Klasse JavaElement
      Siehe auch:
    • getNameRange

      public ISourceRange getNameRange()
      Returns the source range of this local variable's name.
      Angegeben von:
      getNameRange in Schnittstelle ILocalVariable
      Angegeben von:
      getNameRange in Schnittstelle ISourceReference
      Gibt zurück:
      the source range of this local variable's name
      Seit:
      3.7
    • getPath

      public org.eclipse.core.runtime.IPath getPath()
      Beschreibung aus Schnittstelle kopiert: IJavaElement
      Returns the path to the innermost resource enclosing this element. If this element is not included in an external library, the path returned is the full, absolute path to the underlying resource, relative to the workbench. If this element is included in an external library, the path returned is the absolute path to the archive or to the folder in the file system. This is a handle-only method.
      Angegeben von:
      getPath in Schnittstelle IJavaElement
      Setzt außer Kraft:
      getPath in Klasse SourceRefElement
      Gibt zurück:
      the path to the innermost resource enclosing this element
    • resource

      public org.eclipse.core.resources.IResource resource()
      Setzt außer Kraft:
      resource in Klasse SourceRefElement
    • getSource

      public String getSource() throws JavaModelException
      Beschreibung aus Schnittstelle kopiert: ISourceReference
      Returns the source code associated with this element. This extracts the substring from the source buffer containing this source element. This corresponds to the source range that would be returned by getSourceRange.

      For class files, this returns the source of the entire compilation unit associated with the class file (if there is one).

      Angegeben von:
      getSource in Schnittstelle ISourceReference
      Setzt außer Kraft:
      getSource in Klasse SourceRefElement
      Gibt zurück:
      the source code, or null if this element has no associated source code
      Löst aus:
      JavaModelException - if an exception occurs while accessing its corresponding resource
      Siehe auch:
    • getSourceRange

      public ISourceRange getSourceRange() throws JavaModelException
      Returns the source range associated with this element.

      For class files, this returns the range of the entire compilation unit associated with the class file (if there is one).

      If this element has no associated source code, either null is returned, or a source range with a -1 offset and a 0 length. SourceRange.isAvailable(ISourceRange) can be used to detect that case.

      Angegeben von:
      getSourceRange in Schnittstelle ISourceReference
      Setzt außer Kraft:
      getSourceRange in Klasse SourceRefElement
      Gibt zurück:
      the source range, or either null or [-1, 0] if this element has no associated source code
      Löst aus:
      JavaModelException - if an exception occurs while accessing its corresponding resource
      Seit:
      3.7
      Siehe auch:
    • getTypeRoot

      public ITypeRoot getTypeRoot()
      Returns the Java type root in which this local variable is declared.

      This is a handle-only method.

      Angegeben von:
      getTypeRoot in Schnittstelle ILocalVariable
      Gibt zurück:
      the Java type root in which this local variable is declared
      Seit:
      3.7
    • getTypeSignature

      public String getTypeSignature()
      Beschreibung aus Schnittstelle kopiert: ILocalVariable
      Returns the type signature of this local variable.

      The type signature may be either unresolved (for source types) or resolved (for binary types), and either basic (for basic types) or rich (for parameterized types). See Signature for details.

      Angegeben von:
      getTypeSignature in Schnittstelle ILocalVariable
      Gibt zurück:
      the type signature of this local variable.
      Siehe auch:
    • getUnderlyingResource

      public org.eclipse.core.resources.IResource getUnderlyingResource() throws JavaModelException
      Beschreibung aus Schnittstelle kopiert: IJavaElement
      Returns the smallest underlying resource that contains this element, or null if this element is not contained in a resource.
      Angegeben von:
      getUnderlyingResource in Schnittstelle IJavaElement
      Setzt außer Kraft:
      getUnderlyingResource in Klasse SourceRefElement
      Gibt zurück:
      the underlying resource, or null if none
      Löst aus:
      JavaModelException - if this element does not exist or if an exception occurs while accessing its underlying resource
      Siehe auch:
    • hashCode

      public int hashCode()
      Beschreibung aus Klasse kopiert: JavaElement
      Returns the hash code for this Java element. By default, the hash code for an element is a combination of its name and parent's hash code. Elements with other requirements must override this method.
      Setzt außer Kraft:
      hashCode in Klasse JavaElement
    • isParameter

      public boolean isParameter()
      Returns true if this local variable is a method parameter, false otherwise.
      Angegeben von:
      isParameter in Schnittstelle ILocalVariable
      Gibt zurück:
      true if this local variable is a method parameter, false otherwise
      Seit:
      3.7
    • isStructureKnown

      public boolean isStructureKnown() throws JavaModelException
      Beschreibung aus Schnittstelle kopiert: IJavaElement
      Returns whether the structure of this element is known. For example, for a compilation unit that has syntax errors, false is returned. If the structure of an element is unknown, navigations will return reasonable defaults. For example, getChildren for a compilation unit with syntax errors will return a collection of the children that could be parsed.

      Note: This does not imply anything about consistency with the underlying resource/buffer contents.

      Angegeben von:
      isStructureKnown in Schnittstelle IJavaElement
      Setzt außer Kraft:
      isStructureKnown in Klasse SourceRefElement
      Gibt zurück:
      true if the structure of this element is known
      Löst aus:
      JavaModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource
      Siehe auch:
    • getKey

      public String getKey(boolean forceOpen) throws JavaModelException
      Löst aus:
      JavaModelException
      Siehe auch:
      • Ungültige Referenz
        org.eclipse.jdt.internal.compiler.lookup.Binding#computeUniqueKey()
    • toStringInfo

      protected void toStringInfo(int tab, StringBuffer buffer, Object info, boolean showResolvedInfo)
      Beschreibung aus Klasse kopiert: JavaElement
      Debugging purposes
      Setzt außer Kraft:
      toStringInfo in Klasse JavaElement
      Parameter:
      showResolvedInfo - TODO