} else if ( tdescr.getSuperTypes().isEmpty() ) {
tdescr.addSuperType("java.lang.Object");
}
}
Traitable traitableAnn = typeDescr.getTypedAnnotation(Traitable.class);
boolean traitable = traitableAnn != null;
String[] fullSuperTypes = new String[typeDescr.getSuperTypes().size() + 1];
int j = 0;
for (QualifiedName qname : typeDescr.getSuperTypes()) {
fullSuperTypes[j++] = qname.getFullName();
}
fullSuperTypes[j] = Thing.class.getName();
List<String> interfaceList = new ArrayList<String>();
interfaceList.add(traitable ? Externalizable.class.getName() : Serializable.class.getName());
if (traitable) {
interfaceList.add(TraitableBean.class.getName());
}
String[] interfaces = interfaceList.toArray(new String[interfaceList.size()]);
// prepares a class definition
ClassDefinition def;
switch ( type.getKind() ) {
case TRAIT:
def = new ClassDefinition( fullName,
Object.class.getName(),
fullSuperTypes );
break;
case ENUM:
def = new EnumClassDefinition( fullName,
fullSuperTypes[0],
null );
break;
case CLASS:
default:
def = new ClassDefinition( fullName,
fullSuperTypes[0],
interfaces );
def.setTraitable( traitable, traitableAnn != null && traitableAnn.logical() );
}
return def;
}