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

Former-commit-id: b889407df86d1611fee3e09039a7f0113f3167a2
This commit is contained in:
Jeremy Long
2013-06-19 23:28:08 -04:00
parent 973335db56
commit 6244fe5a93

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;
}
}