Validates the filters, making sure each metric has a filter @throws IllegalArgumentException if one or more parameters were invalid
()
| 176 | * @throws IllegalArgumentException if one or more parameters were invalid |
| 177 | */ |
| 178 | private void validateFilters() { |
| 179 | if (filters == null) { |
| 180 | return; |
| 181 | } |
| 182 | |
| 183 | Set<String> ids = new HashSet<String>(); |
| 184 | for (Filter filter : filters) { |
| 185 | ids.add(filter.getId()); |
| 186 | } |
| 187 | |
| 188 | for(Metric metric : metrics) { |
| 189 | if (metric.getFilter() != null && |
| 190 | !metric.getFilter().isEmpty() && |
| 191 | !ids.contains(metric.getFilter())) { |
| 192 | throw new IllegalArgumentException( |
| 193 | String.format("unrecognized filter id %s in metric %s", |
| 194 | metric.getFilter(), metric.getId())); |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * Makes sure the ID has only letters and characters |