X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fclassgen%2FClassFile.java;h=036f923e77e8b230d6e598c62f4abc87c97f0a4f;hb=e33a20a95b926b2e75f07564d672b3a42a6a180a;hp=a5c22f2d1f6ded018b2681dc3fc1919c1781d3e0;hpb=db68756051a8b3c9a08f7c2a27558713b263ad23;p=org.ibex.classgen.git diff --git a/src/org/ibex/classgen/ClassFile.java b/src/org/ibex/classgen/ClassFile.java index a5c22f2..036f923 100644 --- a/src/org/ibex/classgen/ClassFile.java +++ b/src/org/ibex/classgen/ClassFile.java @@ -4,19 +4,28 @@ import java.util.*; import java.io.*; /** Class generation object representing the whole classfile */ -public class ClassFile implements CGConst { +public class ClassFile extends Type.Class.Body { private final Type.Class thisType; - private final Type.Class superType; - private final Type.Class[] interfaces; + final Type.Class superType; + final Type.Class[] interfaces; private final short minor; private final short major; - final int flags; private final Vector fields = new Vector(); - public final Vector methods = new Vector(); - - private final AttrGen attributes; + private final Vector methods = new Vector(); + public Type.Class.Method.Body[] methods() { + Type.Class.Method.Body[] ret = new Type.Class.Method.Body[methods.size()]; + methods.copyInto(ret); + return ret; + } + + public Type.Class.Field.Body[] fields() { + Type.Class.Field.Body[] ret = new Type.Class.Field.Body[fields.size()]; + fields.copyInto(ret); + return ret; + } + static String flagsToString(int flags, boolean isClass) { StringBuffer sb = new StringBuffer(32); if ((flags & PUBLIC) != 0) sb.append("public "); @@ -34,6 +43,7 @@ public class ClassFile implements CGConst { } public Type.Class getType() { return thisType; } + public int getFlags() { return flags; } String debugToString() { return debugToString(new StringBuffer(4096)).toString(); } StringBuffer debugToString(StringBuffer sb) { @@ -45,7 +55,7 @@ public class ClassFile implements CGConst { for(int i=0; i