public boolean compileClassFieldsAndMethods(ParsedClass cl) {
if(!isEntityClass(cl)) return false;
cl.skipInnerObfuscation = true;
parser.code.append("function " + parser.getObfuscatedName(cl));
JCMethodDecl constructor = null;
for(JCTree tr : cl.type.getMembers()) if(tr instanceof JCMethodDecl){
JCMethodDecl m = (JCMethodDecl)tr;
if(parser.isConstructor(m) && parser.hasAnnotation("AJAX", m.getModifiers()) && constructor==null) {
constructor = m;
//System.out.println(cl.name + " - " +m.parameters());
parser.parseParameters("(", m.getParameters(), ") {\n");
//compiler.parse(m.parameters());
}
}
if(constructor==null) {
parser.code.append("() {\n");
}
if(null!=cl.type.getExtendsClause()) {
String superType = cl.type.getExtendsClause().toString();
if(!parser.hasAnnotation(IgnoreExtends.class.getSimpleName(), cl.type.getModifiers()) && !parser.classes.get(superType).isNative) {
parser.code.append(parser.getObfuscatedName(superType)+".call(this);\n");
}
}
Map<String, JCVariableDecl> fields = new TreeMap<String, JCVariableDecl>();
for(JCTree tr : cl.type.getMembers()) if(tr instanceof JCVariableDecl) {
JCVariableDecl f = (JCVariableDecl)tr;
if(parser.isStatic(f.getModifiers())) continue;
// System.out.println(f);
if(parser.hasAnnotation(AjaxTransient.class.getSimpleName(), f.getModifiers())) continue;
if(null!=f.getInitializer()) {
fields.put(f.getName().toString(), f);
}
}
for(JCTree tr : cl.type.getMembers()) if(tr instanceof JCMethodDecl) {
JCMethodDecl m = (JCMethodDecl)tr;
if(parser.isConstructor(m)) continue;
//System.out.println(m.modifiers());
String mName = m.getName().toString();
boolean isAbstract = parser.isAbstract(m.getModifiers());
boolean isStatic = parser.isStatic(m.getModifiers());
boolean isAjax = !parser.hasAnnotation(AjaxTransient.class.getSimpleName(), m.getModifiers())
|| parser.hasAnnotation("Id", m.getModifiers());
if(isAbstract || isStatic || !isAjax) continue;
if(mName.startsWith("get") && m.getParameters().size() == 0) {
String name = Character.toLowerCase(mName.charAt(3)) + mName.substring(4);
fields.remove(name);
VarType type = cl.methods.get(mName).retType;
printFieldInitializer(cl, name, type, fields, VarType.isPrimitiveType(m.getReturnType()));
}
}
for(Map.Entry<String, JCVariableDecl> fe: fields.entrySet()) {
VarType type = cl.fields.get(fe.getKey()).type;