String href;
if (halLink.isTemplated()) {
try {
UriTemplate uriTemplate = UriTemplate.fromTemplate(halLink.getHref());
for (int i = 0; i < args.length; i++) {
for (Annotation annotation : parameterAnnotations[i]) {
if (annotation.annotationType() == UriVariable.class) {
UriVariable uriVariable = (UriVariable) annotation;
assignTemplateValue(uriTemplate, uriVariable.name(), args[i]);
}
}
}
for (int i = 0; i < link.uriValues().length; i++) {
UriValue uriValue = link.uriValues()[i];
assignTemplateValue(uriTemplate, uriValue.name(), uriValue.value());
}
href = uriTemplate.expand();
} catch (MalformedUriTemplateException | VariableExpansionException e) {
throw new RuntimeException(e);
}
} else {
href = halLink.getHref();