diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2004-05-03 17:38:30 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2004-05-03 17:38:30 +0000 |
commit | 1d249157debacc92bc2e4a833ed67dcdc8bad95c (patch) | |
tree | dcb6aa81dc9761490ac1e0062eedcc9264b7304d /src/main/javassist/bytecode/InnerClassesAttribute.java | |
parent | b25388461bd32f33f3a4a188b5eeae957cbb080d (diff) | |
download | javassist-1d249157debacc92bc2e4a833ed67dcdc8bad95c.tar.gz javassist-1d249157debacc92bc2e4a833ed67dcdc8bad95c.zip |
added CtClass#getDeclaringClass()
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@96 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/bytecode/InnerClassesAttribute.java')
-rw-r--r-- | src/main/javassist/bytecode/InnerClassesAttribute.java | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/src/main/javassist/bytecode/InnerClassesAttribute.java b/src/main/javassist/bytecode/InnerClassesAttribute.java index 3f3de406..400a53ca 100644 --- a/src/main/javassist/bytecode/InnerClassesAttribute.java +++ b/src/main/javassist/bytecode/InnerClassesAttribute.java @@ -46,25 +46,67 @@ public class InnerClassesAttribute extends AttributeInfo { /** * Returns <code>classes[nth].inner_class_info_index</code>. */ - public int innerClass(int nth) { + public int innerClassIndex(int nth) { return ByteArray.readU16bit(get(), nth * 8 + 2); } /** + * Returns the class name indicated + * by <code>classes[nth].inner_class_info_index</code>. + * + * @return null or the class name. + */ + public String innerClass(int nth) { + int i = innerClassIndex(nth); + if (i == 0) + return null; + else + return constPool.getClassInfo(i); + } + + /** * Returns <code>classes[nth].outer_class_info_index</code>. */ - public int outerClass(int nth) { + public int outerClassIndex(int nth) { return ByteArray.readU16bit(get(), nth * 8 + 4); } /** + * Returns the class name indicated + * by <code>classes[nth].outer_class_info_index</code>. + * + * @return null or the class name. + */ + public String outerClass(int nth) { + int i = outerClassIndex(nth); + if (i == 0) + return null; + else + return constPool.getClassInfo(i); + } + + /** * Returns <code>classes[nth].inner_name_index</code>. */ - public int innerName(int nth) { + public int innerNameIndex(int nth) { return ByteArray.readU16bit(get(), nth * 8 + 6); } /** + * Returns the simple class name indicated + * by <code>classes[nth].inner_name_index</code>. + * + * @return null or the class name. + */ + public String innerName(int nth) { + int i = innerNameIndex(nth); + if (i == 0) + return null; + else + return constPool.getUtf8Info(i); + } + + /** * Returns <code>classes[nth].inner_class_access_flags</code>. */ public int accessFlags(int nth) { |