JavaClassRep generateClassForType () {
JavaTypeName typeConstructorClassName =
JavaTypeName.make(targetPackage + "." + typeConstructorInfo.javaClassName, false);
TypeConstructor typeConstructor = typeConstructorInfo.typeConstructor;
JavaClassRep outerTypeDefinition =
new OuterTypeDefinitionGenerator().generateOuterTypeDefinition(typeConstructorClassName);
// Now we need to generate inner classes for each data constructor.
// This is only necessary if the data type is not an enumeration.
if (!typeConstructorInfo.isEnumerationType) {
for (int i = 0, n = typeConstructor.getNDataConstructors(); i < n; ++i) {
DataConstructor dc = typeConstructor.getNthDataConstructor(i);
JavaClassRep dcClass = new InnerDCClassGenerator().generateInnerDCClass(dc, typeConstructorInfo, typeConstructorClassName);
outerTypeDefinition.addInnerClass(dcClass);
}
}