added suppertsExtension method to determine if any analyzer supports a specified extension

Former-commit-id: 4d0afb8f8a40e61f9a3fe1a23e2a770f9ee48b65
This commit is contained in:
Jeremy Long
2013-06-19 23:28:08 -04:00
parent d8b3c504f2
commit caae675359

View File

@@ -301,4 +301,24 @@ public class Engine {
}
return ret;
}
/**
* Checks all analyzers to see if an extension is supported.
* @param ext a file extension
* @return true or false depending on whether or not the file extension is supported
*/
public boolean supportsExtension(String ext) {
if (ext == null) {
return false;
}
for (AnalysisPhase phase : AnalysisPhase.values()) {
final List<Analyzer> analyzerList = analyzers.get(phase);
for (Analyzer a : analyzerList) {
if (a.getSupportedExtensions() != null && a.supportsExtension(ext)) {
return true;
}
}
}
return false;
}
}