if (rexsterExtension != null) {
if (rexsterExtension.isConfigurationValid(extensionConfig)) {
final Method[] methods = clazz.getMethods();
for (Method method : methods) {
final ExtensionDescriptor descriptor = method.getAnnotation(ExtensionDescriptor.class);
final ExtensionDefinition definition = method.getAnnotation(ExtensionDefinition.class);
if (definition != null && definition.extensionPoint() == extensionPoint) {
String href = currentExtensionNamespace + "/" + currentExtensionName;
if (!definition.path().isEmpty()) {
href = href + "/" + definition.path();
}
final HashMap<String, Object> hypermediaLink = new HashMap<String, Object>();
hypermediaLink.put("href", href);
hypermediaLink.put("op", definition.method().name());
hypermediaLink.put("namespace", currentExtensionNamespace);
hypermediaLink.put("name", currentExtensionName);
final String path = definition.path();
if (path != null && !path.isEmpty()) {
hypermediaLink.put("path", path);
hypermediaLink.put("title", currentNamespaceAndName + "-" + path);
} else {
hypermediaLink.put("title", currentNamespaceAndName);
}
// descriptor is not a required annotation for extensions.
if (descriptor != null) {
hypermediaLink.put("description", descriptor.description());
}
final JSONArray queryStringParameters = buildQueryStringParameters(method, descriptor);
if (queryStringParameters.length() > 0) {
hypermediaLink.put("parameters", queryStringParameters);