Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

oracle.javatools.parser.java.v2.model
Interface JavaVariable

All Superinterfaces:
Element, JavaElement, JavaHasAnnotations, JavaHasName, JavaHasType
All Known Subinterfaces:
CompiledSelfVariable, CompiledTmpVariable, JavaField, JavaLocalVariable, SourceEnumConstant, SourceFieldVariable, SourceFormalParameter, SourceLocalVariable, SourceMemberVariable, SourceVariable
All Known Implementing Classes:
AbstractField, AbstractVariable, QuickComponent, QuickLocalVariable, Value, WrapperField, WrapperLocalVariable

public interface JavaVariable
extends JavaElement, JavaHasType, JavaHasName, JavaHasAnnotations

The JavaVariable is the compiled representation of a local variable, including formal parameters. If you want the syntactic (aka symbolic) representation of a java variable, see JavaVariable.


Field Summary
static JavaVariable[] EMPTY_ARRAY
           
 
Method Summary
 java.lang.Object getConstantValue()
          TODO: What about static final fields of enum type?
 boolean isVarargs()
           
 
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaHasType
getResolvedType, getUnresolvedType
 
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaHasName
getName
 
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaHasAnnotations
getAnnotation, getAnnotations, getDeclaredAnnotation, getDeclaredAnnotations
 
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaElement
getElementKind, getFile, getModifiers, getOwner, getSourceElement, isDeprecated, isFinal, isHidden, isSourceElement, isSynthetic, printCompiledInfo
 

Field Detail

EMPTY_ARRAY

static final JavaVariable[] EMPTY_ARRAY
Method Detail

isVarargs

boolean isVarargs()
Returns:
True if this is a formal parameter of a variable-length arguments method (or constructor) AND if this parameter is THE variable-length parameter. False otherwise.

getConstantValue

java.lang.Object getConstantValue()
TODO: What about static final fields of enum type?

Returns:
The constant value. Null if this variable does not have a constant value or if the constant value could not be determined.

Note: Constant values cannot be null. Therefore, null indicates no constant value.

If the constant value is of primitive type, it will be wrapped in an object. For example, if the constant value is an int of value 1, then an Integer i such that i.intValue() == 1 will be returned.

If the constant value is of String type, a String of same value will be returned.

If the constant value is an array, then an array of Object[] will be returned. If the constant value is an int array with single element one, then an Object[ 1 ] with single entry Integer i such that i.intValue() == 1 will be returned.

If the constant value is an enum constant, the enum constant itself is NOT returned because of practical considerations regarding classloading. Instead, a JavaField corresponding to that enum constant is returned. Notice that if "this" is an enum constant, then "this" is returned because it itself represents the enum constant.

If the constant value is a class literal, then a JavaType corresponding to the class is returned. This cannot be a JavaClass because some class literals are array types.


Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

Copyright © 1997, 2011, Oracle. All rights reserved.