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

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

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

import com.damnhandy.uri.template.UriTemplate;
import com.fasterxml.jackson.databind.JsonNode;
import com.github.osvaldopina.signedcontract.enforcer.Navigator;
import com.github.osvaldopina.signedcontract.enforcer.SignedContractException;

public class HalLinkTemplatedUriTemplateNavigator implements Navigator {

    @Override
    public UriTemplate navigate(JsonNode document) {

        if (document.has("href")) {
            String href = document.get("href").asText();
            return UriTemplate.fromTemplate(href);
        }
        else {
            throw new SignedContractException("hal link without href property is not valid");
        }
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy