I try to create a class BasicType
public class BasicType implements java.io.Serializable{
String _ISBN;
public java.lang.String getISBN();
public void setISBN(java.lang.String);
public BasicType();
}
But I always get an abstract class, and the interface Serializable is not
correct.
C:\>javap BasicType
Compiled from "FrameType.java"
public abstract class BasicType extends java.lang.Object{
public java.lang.String getISBN();
public void setISBN(java.lang.String);
public BasicType();
}
Anybody know why?
Here are my codes:
try {
ClassPool pool = ClassPool.getDefault();
pool.importPackage("java.io.Serializable");
CtClass cls = pool.makeClass("BasicType");
cls.addInterface(pool.get("java.io.Serializable"));
CtField cfld = CtField.make("private java.lang.String _ISBN;",
cls);
cls.addField(cfld);
CtMethod m = CtNewMethod.make("public java.lang.String
getISBN();", cls);
cls.addMethod(m);
m.setBody("return _ISBN;");
CtMethod m1 = CtNewMethod.make("public void
setISBN(java.lang.String isbn);", cls);
cls.addMethod(m1);
m1.setBody(" _ISBN = $1;");
cls.writeFile("c:\\");
}
catch (CannotCompileException e) {
System.err.println("Cannot Compile Exception error");
}
catch (NotFoundException e) {
System.err.println("Not Found Exception error");
}
catch (IOException e) {
System.err.println("IO Exception error");
}
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3945914#3945914
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3945914
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user