@Override public void validate( final Processor<FullData, FullData> processor, final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final SchemaTree tree = data.getSchema(); final JsonPointer schemaPointer = tree.getPointer(); final JsonNode schemas = tree.getNode().get(keyword); final int size = schemas.size(); final ObjectNode fullReport = FACTORY.objectNode(); int nrSuccess = 0; ListProcessingReport subReport; JsonPointer ptr; FullData newData; for (int index = 0; index < size; index++) { subReport = new ListProcessingReport(report.getLogLevel(), LogLevel.FATAL); ptr = schemaPointer.append(JsonPointer.of(keyword, index)); newData = data.withSchema(tree.setPointer(ptr)); processor.process(subReport, newData); fullReport.put(ptr.toString(), subReport.asJson()); if (subReport.isSuccess()) nrSuccess++; } if (nrSuccess == 0) report.error( newMsg(data, bundle, "err.common.schema.noMatch") .putArgument("nrSchemas", size) .put("reports", fullReport)); }
private static final class DummyProcessor implements Processor<FullData, FullData> { private static final JsonPointer PTR = JsonPointer.of("not"); private final WantedState wanted; private DummyProcessor(final WantedState wanted) { this.wanted = wanted; } @Override public FullData process(final ProcessingReport report, final FullData input) throws ProcessingException { assertEquals(input.getSchema().getPointer(), PTR); wanted.doIt(report); return input; } }