Package com.github.fge.jackson.jsonpointer

Examples of com.github.fge.jackson.jsonpointer.JsonPointer


    for (JsonPatchOperation operation : readValue) {

      if (operation instanceof RemoveOperation) {

        // Replace remove operation with replace operation and a value of null.
        JsonPointer path = (JsonPointer) ReflectionUtils.getField(PATH_FIELD, operation);
        patchedNode = new ReplaceOperation(path, NullNode.getInstance()).apply(patchedNode);

      } else {
        patchedNode = operation.apply(patchedNode);
      }
View Full Code Here


        for (final JsonNode node: testNode) {
            digest = node.get("digest");
            elementIndex = node.get("elementIndex").intValue();
            ret = Lists.newArrayList();
            for (final JsonNode element: node.get("ret"))
                ret.add(new JsonPointer(element.textValue()));
            list.add(new Object[]{ digest, elementIndex, ret });
        }

        return list.iterator();
    }
View Full Code Here

        for (final JsonNode node: testNode) {
            digest = node.get("digest");
            memberName = node.get("memberName").textValue();
            ret = Lists.newArrayList();
            for (final JsonNode element: node.get("ret"))
                ret.add(new JsonPointer(element.textValue()));
            list.add(new Object[]{ digest, memberName, ret });
        }

        return list.iterator();
    }
View Full Code Here

     * @see #pop()
     */
    void push(final FullData data)
        throws ProcessingException
    {
        final JsonPointer ptr = data.getInstance().getPointer();
        final SchemaURI schemaURI = new SchemaURI(data.getSchema());

        if (ptr.equals(pointer)) {
            if (schemaURIs.contains(schemaURI))
                throw new ProcessingException(validationLoopMessage(data));
            schemaURIs.addLast(schemaURI);
            return;
        }
View Full Code Here

        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 != 1)
View Full Code Here

            final FullData input)
            throws ProcessingException
        {
            final JsonNode schema = input.getSchema().getNode();

            final JsonPointer ptr = schema == sub1 ? ptr1 : ptr2;
            assertEquals(input.getSchema().getPointer(), ptr,
                "schema pointer differs from expectations");

            final WantedState wanted = schema == sub1 ? wanted1 : wanted2;
            wanted.doIt(report);
View Full Code Here

                .putArgument("disallowed", toArrayNode(types)));
            return;
        }

        final SchemaTree tree = data.getSchema();
        final JsonPointer schemaPointer = tree.getPointer();
        final ObjectNode fullReport = FACTORY.objectNode();

        JsonPointer ptr;
        ListProcessingReport subReport;
        FullData newData;
        int nrSuccess = 0;

        for (final int index: schemas) {
            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)
View Full Code Here

        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 != size)
View Full Code Here

        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)
View Full Code Here

    public JsonSchema getJsonSchema(final JsonNode schema, final String ptr)
        throws ProcessingException
    {
        BUNDLE.checkNotNull(schema, "nullSchema");
        CORE_BUNDLE.checkNotNull(ptr, "nullPointer");
        final JsonPointer pointer;
        try {
            pointer = new JsonPointer(ptr);
            return validator.buildJsonSchema(schema, pointer);
        } catch (JsonPointerException ignored) {
            // Cannot happen
        }
        throw new IllegalStateException("How did I get there??");
View Full Code Here

TOP

Related Classes of com.github.fge.jackson.jsonpointer.JsonPointer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.