if (containingClass != null && !generatedClassVariables.contains(attrVarName)) {
generatedClassVariables.add(attrVarName);
containingClass.privateField(attrVarName, ErraiAttribute.class)
.modifiers(Modifier.Final)
.initializesWith(
Stmt.nestedCall(new StringStatement("entityManager.getMetamodel()", MetaClassFactory.get(ErraiMetamodel.class)))
.invoke("entity", Stmt.loadLiteral(lhsType))
.invoke("getAttribute", dotNode.getPropertyPath()))
.finish();
}
// XXX need a StringStatement here because codegen can't see fields of anonymous inner classes. (ERRAI-363)
return Stmt.nestedCall(new StringStatement(attrVarName, MetaClassFactory.get(ErraiAttribute.class)))
.invoke("get", Stmt.loadVariable(variableName));
}