APIdia Launch Partner
Top Description Methods
com.sun.jdi

public Interface LocalVariable

extends Mirror, Comparable<LocalVariable>
Known Direct Implementers
com.sun.tools.jdi.LocalVariableImpl

A local variable in the target VM. Each variable declared within a Method has its own LocalVariable object. Variables of the same name declared in different scopes have different LocalVariable objects. LocalVariables can be used alone to retrieve static information about their declaration, or can be used in conjunction with a StackFrame to set and get values.
Authors
Robert Field, Gordon Hirsch, James McIlree
Since
1.3
See Also
StackFrame, Method

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the Object is a LocalVariable, if both LocalVariables are contained in the same method (as determined by Method#equals), and if both LocalVariables mirror the same declaration within that method
equals
(Object obj)

Compares the specified Object with this LocalVariable for equality.

public String

Returns:

a string containing the generic signature, or null if there is no generic signature.
genericSignature
()

Gets the generic signature for this variable if there is one.

public int

Returns:

the integer hash code
hashCode
()

Returns the hash code value for this LocalVariable.

public boolean

Returns:

true if this variable is an argument; false otherwise.
isArgument
()

Determines if this variable is an argument to its method.

public boolean

Returns:

true if this variable is visible; false otherwise.
isVisible
(StackFrame
the StackFrame querying visibility
frame
)

Determines whether this variable can be accessed from the given StackFrame.

public String

Returns:

a string containing the name.
name
()

Gets the name of the local variable.

public String

Returns:

a string containing the signature.
signature
()

Gets the type signature of the local variable.

public Type

Returns:

the Type of this local variable.
type
()

Returns the type of this variable.

public String

Returns:

a String representing the type of this local variable.
typeName
()

Returns a text representation of the type of this variable.

Inherited from com.sun.jdi.Mirror:
toStringvirtualMachine
Inherited from java.lang.Comparable:
compareTo

Method Detail

equalsback to summary
public boolean equals(Object obj)

Compares the specified Object with this LocalVariable for equality.

Returns:boolean

true if the Object is a LocalVariable, if both LocalVariables are contained in the same method (as determined by Method#equals), and if both LocalVariables mirror the same declaration within that method

genericSignatureback to summary
public String genericSignature()

Gets the generic signature for this variable if there is one. Generic signatures are described in the The Java Virtual Machine Specification.

Returns:String

a string containing the generic signature, or null if there is no generic signature.

Since
1.5
hashCodeback to summary
public int hashCode()

Returns the hash code value for this LocalVariable.

Returns:int

the integer hash code

isArgumentback to summary
public boolean isArgument()

Determines if this variable is an argument to its method.

Returns:boolean

true if this variable is an argument; false otherwise.

isVisibleback to summary
public boolean isVisible(StackFrame frame)

Determines whether this variable can be accessed from the given StackFrame. See StackFrame#visibleVariables for a complete description variable visibility in this interface.

Parameters
frame:StackFrame

the StackFrame querying visibility

Returns:boolean

true if this variable is visible; false otherwise.

Exceptions
IllegalArgumentException:
if the stack frame's method does not match this variable's method.
nameback to summary
public String name()

Gets the name of the local variable.

Returns:String

a string containing the name.

signatureback to summary
public String signature()

Gets the type signature of the local variable.

Returns:String

a string containing the signature.

typeback to summary
public Type type() throws ClassNotLoadedException

Returns the type of this variable. Where the type is the type specified in the declaration of this local variable.

Note

if the type of this variable is a reference type (class, interface, or array) and it has not been created or loaded by the class loader of the enclosing class, then ClassNotLoadedException will be thrown. Also, a reference type may have been loaded but not yet prepared, in which case the type will be returned but attempts to perform some operations on the returned type (e.g. fields()) will throw a ClassNotPreparedException. Use ReferenceType#isPrepared() to determine if a reference type is prepared.

Returns:Type

the Type of this local variable.

Exceptions
ClassNotLoadedException:
if the type has not yet been loaded through the appropriate class loader.
See Also
Type, Field.type() - for usage examples
typeNameback to summary
public String typeName()

Returns a text representation of the type of this variable. Where the type is the type specified in the declaration of this local variable.

This type name is always available even if the type has not yet been created or loaded.

Returns:String

a String representing the type of this local variable.