try {
if (node.has("javaType")) {
String fqn = node.get("javaType").asText();
if (isPrimitive(fqn, container.owner())) {
throw new GenerationException("Primitive type '" + fqn + "' cannot be used as an enum.");
}
try {
Class<?> existingClass = Thread.currentThread().getContextClassLoader().loadClass(fqn);
throw new ClassAlreadyExistsException(container.owner().ref(existingClass));
} catch (ClassNotFoundException e) {
return container.owner()._class(fqn, ClassType.ENUM);
}
} else {
try {
return container._class(modifiers, getEnumName(nodeName), ClassType.ENUM);
} catch (JClassAlreadyExistsException e) {
throw new GenerationException(e);
}
}
} catch (JClassAlreadyExistsException e) {
throw new ClassAlreadyExistsException(e.getExistingClass());
}