1 Reply Latest reply on May 3, 2003 9:32 AM by chiba

    write  CtClass object to an external repositary  storage

    mingqin

      yamazaki
      The example given by you illustrated how to create a new class and add fields ( methods) to that newly created class "someClass". If I want to store this newly created class into an external storage such as disk, LDAP, database etc. How can I write this "someClass" from Virtual Machine LoadTime to thoe external storages? More specifial requirments like this:
      create an modified or new "someClass" by javasssit
      output "someClass" to external storages as someClass.class , even someClass.java

      I think this is doable and might your team already have done this.
      _________________________________________
      ClassPool pool = ClassPool.getDefault();
      CtClass cc = pool.makeClass("someClass");
      CtClass ccObject = pool.get("java.lang.Object");
      CtField field = new CtField(ccObject, "someField", cc);
      cc.addField(field);
      cc.toClass()
      __________________________________________