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

E13403-03

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

All Superinterfaces:
Element, JavaElement, JavaHasAnnotations, JavaHasName, JavaHasType, JavaIsGeneric, JavaMember
All Known Subinterfaces:
SourceMethod
All Known Implementing Classes:
AbstractMethod, CastedMethod, QuickComponent, QuickMethod, WrapperMethod

public interface JavaMethod
extends JavaMember, JavaIsGeneric

The JavaMethod is the compiled representation of a java method or constructor, including the implicit <clinit> method. If you want the syntactic (aka symbolic) representation of a java class, see JavaMethod.


Field Summary
static JavaMethod[] EMPTY_ARRAY
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.lang.Object getDefaultValue()
           
 java.lang.String getDescriptor()
          Important: This is not the same as getReturnType().getDescriptor() which is synonymous with getReturnType().getDescriptor().
 java.util.Collection getExceptions()
           
 JavaMethod getMethodErasure()
          Gets the erasure for this method.
 java.util.Collection getOverriddenMethods()
          According to the JLS, implementing methods are overriding methods where the overriden method is abstract.
 java.util.Collection getParameters()
           
 JavaType[] getParameterTypes()
           
 JavaType getReturnType()
          All constructors have a return type of "void".
 java.lang.String getSignature()
          Important: This is not the same as getReturnType().getSignature() which is synonymous with getReturnType().getSignature().
 java.lang.String getTypeSignature()
          Not a JVMS term.
 boolean hasSubsignatureOf(JavaMethod other)
          True if this method's signature is a subsignature of the other method's signature.
 boolean isConstructor()
           
 boolean isNative()
           
 boolean isVarargs()
           
 
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaIsGeneric
getActualTypeArguments, getTypeParameter, getTypeParameters, hasActualTypeArguments, hasTypeParameters
 
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaMember
getOwningClass, getUniqueIdentifier, isAbstract, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic
 
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 JavaMethod[] EMPTY_ARRAY
Method Detail

isConstructor

boolean isConstructor()
Returns:
True if this is a constructor, false otherwise.

isVarargs

boolean isVarargs()
Returns:
True if this is a variable argument method, false otherwise.

isNative

boolean isNative()
Returns:
True if this method has been marked as native.

getMethodErasure

JavaMethod getMethodErasure()
Gets the erasure for this method. Here, we define method erasure as the result when all parameterized information is erased. Contrast with type erasure where both generic and parameterized information is erased.

The erasure of a method that is not at all generic is trivially itself. The erasure of a method that is completely unparameterized method is also trivially itself.

Note: Erasure is performed strictly on this method and its owning type and is not performed on any of the contained types. For example, consider the method List<String>.get(int) which has a String return type. The parameterization is from List's E type parameter to String. Erasing the parameterization leaves us with List.get(int) which returns has a E return type.

Returns:
The JavaMethod for this method's erasure.

getReturnType

JavaType getReturnType()
All constructors have a return type of "void".

Returns:
The return type.

getParameters

java.util.Collection getParameters()
Returns:
The array of formal parameters, including the implicit "this$0" parameter if applicable. Returns a collection of JavaVariable's. Note, the "this$0" parameter will be a CompiledTmpVariable which is not compatible with JavaLocalVariable.

getParameterTypes

JavaType[] getParameterTypes()
Returns:
The array of types for the formal parameters, including the implicit "this$0" parameter if applicable. The array is populated with the result of calling getResolvedType() on each parameter returned by getParameters(). Parameter types that fail to resolve will show up as null values in the array.

getExceptions

java.util.Collection getExceptions()
Returns:
The array of checked exceptions. Oddly enough, this includes RuntimeExceptions which, as you know, are ignored by the compiler. (This matches the behavior of java/lang/reflect/Method.) Returns a collection of JavaType's.

getDefaultValue

java.lang.Object getDefaultValue()
Returns:
The default value, if any. Applies only to annotation components.
See Also:
JavaVariable.getConstantValue()

getDescriptor

java.lang.String getDescriptor()
Important: This is not the same as getReturnType().getDescriptor() which is synonymous with getReturnType().getDescriptor(). This returns the method's pre-jdk-1.5 descriptor.


getTypeSignature

java.lang.String getTypeSignature()
Not a JVMS term. Start with the MethodSignature. If there are any actual type arguments, then the type signature of those type arguments (similar to ClassTypeSignature) is appended to the result. Uniquely identifies a method's signature.


getSignature

java.lang.String getSignature()
Important: This is not the same as getReturnType().getSignature() which is synonymous with getReturnType().getSignature(). This returns the method's jdk-1.5 signature.


hasSubsignatureOf

boolean hasSubsignatureOf(JavaMethod other)
True if this method's signature is a subsignature of the other method's signature. For shorthand, we say that "this" method has a subsignature of the "other" method.


getOverriddenMethods

java.util.Collection getOverriddenMethods()
According to the JLS, implementing methods are overriding methods where the overriden method is abstract. Order is depth-first, classes before interfaces, left-to-right.

Returns:
The array of methods overriden by this one.

equals

boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object
Returns:
True if o is a JavaMethod and has the same owning class, name, and signature as this method.

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

E13403-03

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