From: Shigeru C. <ch...@us...> - 2004-05-03 17:38:36
|
User: chiba Date: 04/05/03 10:38:29 Modified: src/main/javassist/bytecode InnerClassesAttribute.java Log: added CtClass#getDeclaringClass() Revision Changes Path 1.6 +45 -3 javassist/src/main/javassist/bytecode/InnerClassesAttribute.java Index: InnerClassesAttribute.java =================================================================== RCS file: /cvsroot/jboss/javassist/src/main/javassist/bytecode/InnerClassesAttribute.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- InnerClassesAttribute.java 8 Jan 2004 17:22:25 -0000 1.5 +++ InnerClassesAttribute.java 3 May 2004 17:38:29 -0000 1.6 @@ -46,25 +46,67 @@ /** * 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) { |