Checks if this analysis class declares a public static field "ID" and its value is identical to the analysis id in the configuration.
()
| 59 | * and its value is identical to the analysis id in the configuration. |
| 60 | */ |
| 61 | private void validateId() { |
| 62 | Class<?> analysisClass = getClass(); |
| 63 | try { |
| 64 | Field idField = analysisClass.getField("ID"); |
| 65 | String id = (String) idField.get(null); |
| 66 | if (!id.equals(getId())) { |
| 67 | throw new ConfigException(String.format( |
| 68 | "Config ID (%s) and analysis ID (%s) of %s are not matched", |
| 69 | getId(), id, analysisClass)); |
| 70 | } |
| 71 | } catch (NoSuchFieldException | IllegalAccessException e) { |
| 72 | throw new AnalysisException(String.format("Failed to get analysis ID of %s," + |
| 73 | " please add public static field 'ID' in %s" + |
| 74 | analysisClass, analysisClass)); |
| 75 | } |
| 76 | } |
| 77 | } |