All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.osvaldopina.signedcontract.enforcer.jsonhal.HalJsonResourceOnlyNavigator Maven / Gradle / Ivy

There is a newer version: 0.0.5
Show newest version
package com.github.osvaldopina.signedcontract.enforcer.jsonhal;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.github.osvaldopina.signedcontract.enforcer.Navigator;
import com.github.osvaldopina.signedcontract.enforcer.SignedContractException;

import java.util.Arrays;

public class HalJsonResourceOnlyNavigator implements Navigator {


    @Override
    public JsonNode navigate(JsonNode documentClause) {
        if (! (documentClause instanceof ObjectNode)) {
            throw new SignedContractException("Hal json document must be a json object");
        }
        ObjectNode copiedDocumentClause = ((ObjectNode) documentClause).deepCopy();
        copiedDocumentClause.remove(Arrays.asList("_links", "_embedded"));
        return copiedDocumentClause;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy