interfaceList.add( TraitableBean.class.getName() );
}
String[] interfaces = interfaceList.toArray( new String[ interfaceList.size() ] );
// prepares a class definition
ClassDefinition def = null;
if ( type.getFormat().equals( TypeDeclaration.Format.TRAIT ) ) {
def = new ClassDefinition( fullName,
"java.lang.Object",
fullSuperTypes );
} else {
def = new ClassDefinition( fullName,
fullSuperTypes[0],
interfaces );
def.setTraitable( traitable );
}
for ( String annotationName : typeDescr.getAnnotationNames() ) {
Class annotation = resolveAnnotation( annotationName,
pkgRegistry.getTypeResolver() );
if ( annotation != null ) {
try {
AnnotationDefinition annotationDefinition = AnnotationDefinition.build(
annotation,
typeDescr.getAnnotations().get( annotationName ).getValueMap(),
pkgRegistry.getTypeResolver() );
def.addAnnotation( annotationDefinition );
} catch ( NoSuchMethodException nsme ) {
this.results.add( new TypeDeclarationError( "Annotated type " + fullName + " - undefined property in @annotation " + annotationName + ": " + nsme.getMessage() + ";",
typeDescr.getLine() ) );
}
}
}
// fields definitions are created. will be used by subclasses, if any.
// Fields are SORTED in the process
if ( typeDescr.getFields().size() > 0 ) {
PriorityQueue<FieldDefinition> fieldDefs = sortFields( typeDescr.getFields(),
pkgRegistry );
while ( fieldDefs.size() > 0 ) {
FieldDefinition fld = fieldDefs.poll();
def.addField( fld );
}
}
// check whether it is necessary to build the class or not
type.setNovel( isNovelClass( typeDescr ) );