use of com.emc.apidocs.model.ApiErrorCode in project coprhd-controller by CoprHD.
the class ApiDoclet method start.
/**
* MAIN Entry Point into the Doclet
*/
public static boolean start(RootDoc root) {
KnownPaths.init(contentDirectory, outputDirectory);
init();
loadServiceBlackList();
loadMethodBlackList();
List<ApiService> apiServices = findApiServices(root.classes());
List<ApiErrorCode> errorCodes = findErrorCodes(root.classes());
cleanupMethods(apiServices);
saveMetaData(apiServices);
ApiDifferences apiDifferences = calculateDifferences(apiServices);
generateFiles(apiDifferences, apiServices, errorCodes);
return true;
}
use of com.emc.apidocs.model.ApiErrorCode in project coprhd-controller by CoprHD.
the class ApiDoclet method findErrorCodes.
private static synchronized List<ApiErrorCode> findErrorCodes(ClassDoc[] classes) {
// Find ServiceCode Class
ClassDoc serviceCodeClass = null;
for (ClassDoc classDoc : classes) {
if (classDoc.qualifiedName().equals(ServiceCode.class.getCanonicalName())) {
serviceCodeClass = classDoc;
break;
}
}
if (serviceCodeClass == null) {
throw new RuntimeException("Unable to find ServiceCode Class");
}
// Extract ServiceCode information
List<ApiErrorCode> errorCodes = Lists.newArrayList();
for (FieldDoc field : serviceCodeClass.enumConstants()) {
ApiErrorCode errorCode = new ApiErrorCode(ServiceCode.valueOf(field.name()));
if (AnnotationUtils.hasAnnotation(field, KnownAnnotations.Deprecated_Annotation)) {
errorCode.setDeprecated(true);
}
errorCodes.add(errorCode);
}
Collections.sort(errorCodes, new Comparator<ApiErrorCode>() {
@Override
public int compare(ApiErrorCode o1, ApiErrorCode o2) {
return Integer.valueOf(o1.getCode()).compareTo(o2.getCode());
}
});
return errorCodes;
}
Aggregations