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

com.github.hal4j.resources.curie.CurieResolver Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
package com.github.hal4j.resources.curie;

import com.github.hal4j.uritemplate.URITemplate;

/**
 * Represents a function that maps HAL link namespaces to URI templates. When constructing a resource
 * the resource builder uses an instance implementing this interface to include CURIE links for each HAL link
 * with a namespace.
 *
 * Example:
 * 
 * {
 *      "_links" : {
 *          "curies" : [
 *              {
 *                  "href" : "https://my.example.com/apidoc/v1/{rel}",
 *                  "name" : "my",
 *                  "template" : "true"
 *              },
 *              {
 *                  "href" : "https://docs.another.com/api/{rel}",
 *                  "name" : "another",
 *                  "template" : "true"
 *              }
*           ],
 *          "my:link" { "href": "https://my.example.com/api/v1/something" },
 *          "another:endpoint" { "href": "https://api.another.com/endpoint" },
 *          "self": { "href" : "https://api.example.com/object/123" }
 *      }
 * }
 * 
* In this example namespace my wasresolved * to URI template https://my.example.com/apidoc/v1/{rel} * and namespace another to https://docs.another.com/api/{rel} * * @see com.github.hal4j.resources.ResourceSupport * @see com.github.hal4j.resources.HALLink */ public interface CurieResolver { /** * Name of the relation containing CURIE links */ String REL_CURIES = "curies"; /** * Returns CURIE link for given namespace * @param namespace the namespace to look up the link * @return CURIE link as URI template */ URITemplate resolve(String namespace); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy