站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

EnclosingMethod (Classfile Reader) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.classfile/1 1.19

org.netbeans.modules.classfile
Class EnclosingMethod

java.lang.Object
  extended by org.netbeans.modules.classfile.EnclosingMethod

public final class EnclosingMethod
extends Object

A class representing the enclosing method of an inner class. An enclosing method is similar to a CPMethodInfo type, but differs in two respects. First, the classfile stores this information in an "EnclosingMethod" attribute, rather than in the constant pool Second, an enclosing method attribute may not actually have a method reference (only a class reference). This is because the inner class is defined in an init block instead of an actual method.

See Also:
ClassFile.getEnclosingMethod()

Method Summary
 CPClassInfo getClassInfo()
          Returns the constant pool entry for the enclosing class.
 ClassName getClassName()
           
 CPNameAndTypeInfo getMethodInfo()
          Returns the constant pool entry for the enclosing method, or null if the inner class was defined outside of any method or constructor bodies.
 boolean hasMethod()
          Returns whether the enclosing method attribute describes a method the inner class is defined within.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getClassName

public ClassName getClassName()

getClassInfo

public CPClassInfo getClassInfo()
Returns the constant pool entry for the enclosing class.


hasMethod

public boolean hasMethod()
Returns whether the enclosing method attribute describes a method the inner class is defined within. If false, then the inner class was defined in an init block (or statement) in the class, outside of any method or constructor bodies.


getMethodInfo

public CPNameAndTypeInfo getMethodInfo()
Returns the constant pool entry for the enclosing method, or null if the inner class was defined outside of any method or constructor bodies. Note: a CPNameAndTypeInfo instance is returned because the method is external to the enclosed class. Do not attempt to cast it to a CPMethodInfo type, which is an internal method structure.


toString

public String toString()
Overrides:
toString in class Object

org.netbeans.modules.classfile/1 1.19

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.