views:

108

answers:

1

hi, is it possible to create a new java file from existing java file after changing some of its attributes at runtime??

Suppose i have a java file

pubic class Student{

    private int rollNo;
    private String name;
    // getters and setters
    // constructor
}

is it possible to create something like this, provided that rollNo is key element for the table..

public class Student {
   private StudentKey key;
   private String name;
   //getters and setters
   //constructor
}
public class StudentKey {
    private int rollNo;
    // getters and setters
    // construcotors
}

please help..

+1  A: 

Take a look at javassist.

Skeptic