I have several java code file and I have to add a public class level variable in each of them. There are so many files that I need to write a python 2.2 script to do the same.
package xx.xx.xx;
import java.util.Properties;
public class MyClass extends YourClass{
public myMethod() throws MyException {
}
}
expected output
package xx.xx.xx;
import java.util.Properties;
public class MyClass extends YourClass{
public static final String CO_ID = "XXXXX"
public myMethod() throws MyMException {
}
}
I know file.find('{') give me the index of the first occurrence of { but I need push rest of the code down and insert my public member in each file.