if(informerInfos.superClassName!=null && !"Object".equals(informerInfos.superClassName)) {
List<ClassOrInterfaceType> extended = new LinkedList<ClassOrInterfaceType>();
extended.add(new ClassOrInterfaceType(InformerInfos.buildAbstractInformerName(informerInfos.superClassName)));
type.setExtends(extended);
}
type.setJavaDoc(new JavadocComment("\n" +
"Informer method container for {@link " + informerInfos.className + "}\n" +
"This interface is to be used only by gaedo code. Its only role is to provide consistent method hierarchy.\n" +
"As a consequence, refering to it directly has not the slightest interest and should never been done in user code." +
"@author InformerMojos\n"));
List<AnnotationExpr> annotations = new LinkedList<AnnotationExpr>();
// Constructing generated annotation value
List<MemberValuePair> parameters = new LinkedList<MemberValuePair>();
parameters.add(new MemberValuePair("date", new StringLiteralExpr(
javax.xml.bind.DatatypeConverter.printDateTime(GregorianCalendar.getInstance()))));
parameters.add(new MemberValuePair("comments", new StringLiteralExpr("generated by gaedo-informer-generator")));
List<Expression> values = new LinkedList<Expression>();
values.add(new StringLiteralExpr(informerInfos.getQualifiedClassName()));
parameters.add(new MemberValuePair("value",
new ArrayInitializerExpr(values)));
NormalAnnotationExpr generated = new NormalAnnotationExpr(ASTHelper.createNameExpr(Generated.class.getName()), parameters);
annotations.add(generated);
type.setAnnotations(annotations);
ASTHelper.addTypeDeclaration(cu, type);
for (PropertyInfos infos : informerInfos.properties) {
// create a method
MethodDeclaration method = new MethodDeclaration(ModifierSet.PUBLIC, ASTHelper.VOID_TYPE, "get" + Utils.uppercaseFirst(infos.name));
String informerTypeFor = InformerTypeFinder.getInformerTypeFor(resolvedInformers, qualifiedEnums, imports, infos);
method.setType(new ClassOrInterfaceType(informerTypeFor));
method.setJavaDoc(new JavadocComment(infos.generateJavadoc(informerInfos, informerTypeFor)));
ASTHelper.addMember(type, method);
}
imports.remove(informerInfos.classPackage);
imports.remove("java.lang");