示例#1
0
  public void visitJavaClass(JavaClass clazz) {
    clazz.accept(visitor);

    Field[] fields = clazz.getFields();
    for (int i = 0; i < fields.length; i++) fields[i].accept(this);

    Method[] methods = clazz.getMethods();
    for (int i = 0; i < methods.length; i++) methods[i].accept(this);

    Attribute[] attributes = clazz.getAttributes();
    for (int i = 0; i < attributes.length; i++) attributes[i].accept(this);

    clazz.getConstantPool().accept(this);
  }
示例#2
0
  private void writeMainHTML(AttributeHTML attribute_html) throws IOException {
    PrintWriter file = new PrintWriter(new FileOutputStream(dir + class_name + ".html"));
    Attribute[] attributes = java_class.getAttributes();

    file.println(
        "<HTML>\n"
            + "<HEAD><TITLE>Documentation for "
            + class_name
            + "</TITLE>"
            + "</HEAD>\n"
            + "<FRAMESET BORDER=1 cols=\"30%,*\">\n"
            + "<FRAMESET BORDER=1 rows=\"80%,*\">\n"
            + "<FRAME NAME=\"ConstantPool\" SRC=\""
            + class_name
            + "_cp.html"
            + "\"\n MARGINWIDTH=\"0\" "
            + "MARGINHEIGHT=\"0\" FRAMEBORDER=\"1\" SCROLLING=\"AUTO\">\n"
            + "<FRAME NAME=\"Attributes\" SRC=\""
            + class_name
            + "_attributes.html"
            + "\"\n MARGINWIDTH=\"0\" "
            + "MARGINHEIGHT=\"0\" FRAMEBORDER=\"1\" SCROLLING=\"AUTO\">\n"
            + "</FRAMESET>\n"
            + "<FRAMESET BORDER=1 rows=\"80%,*\">\n"
            + "<FRAME NAME=\"Code\" SRC=\""
            + class_name
            + "_code.html\"\n MARGINWIDTH=0 "
            + "MARGINHEIGHT=0 FRAMEBORDER=1 SCROLLING=\"AUTO\">\n"
            + "<FRAME NAME=\"Methods\" SRC=\""
            + class_name
            + "_methods.html\"\n MARGINWIDTH=0 "
            + "MARGINHEIGHT=0 FRAMEBORDER=1 SCROLLING=\"AUTO\">\n"
            + "</FRAMESET></FRAMESET></HTML>");

    file.close();

    for (int i = 0; i < attributes.length; i++)
      attribute_html.writeAttribute(attributes[i], "class" + i);
  }
示例#3
0
  /**
   * Initialize with existing class.
   *
   * @param clazz JavaClass object (e.g. read from file)
   */
  public ClassGen(JavaClass clazz) {
    class_name_index = clazz.getClassNameIndex();
    superclass_name_index = clazz.getSuperclassNameIndex();
    class_name = clazz.getClassName();
    super_class_name = clazz.getSuperclassName();
    file_name = clazz.getSourceFileName();
    access_flags = clazz.getAccessFlags();
    cp = new ConstantPoolGen(clazz.getConstantPool());
    major = clazz.getMajor();
    minor = clazz.getMinor();

    Attribute[] attributes = clazz.getAttributes();
    Method[] methods = clazz.getMethods();
    Field[] fields = clazz.getFields();
    String[] interfaces = clazz.getInterfaceNames();

    for (int i = 0; i < interfaces.length; i++) addInterface(interfaces[i]);

    for (int i = 0; i < attributes.length; i++) addAttribute(attributes[i]);

    for (int i = 0; i < methods.length; i++) addMethod(methods[i]);

    for (int i = 0; i < fields.length; i++) addField(fields[i]);
  }