private static void addService(Method m, ResourceFacade<?> entity, UriInfo uriInfo,
RESTServiceDiscovery ret, LinkResource service, String rel) {
Map<String, ? extends Object> pathParameters = entity.pathParameters();
// do we need any path parameters?
UriBuilder uriBuilder = uriInfo.getBaseUriBuilder().path(m.getDeclaringClass());
if(m.isAnnotationPresent(Path.class))
uriBuilder.path(m);
URI uri;
List<String> paramNames = ((UriBuilderImpl)uriBuilder).getPathParamNamesInDeclarationOrder();
if(paramNames.isEmpty())
uri = uriBuilder.build();
else if(pathParameters.size() >= paramNames.size())
uri = uriBuilder.buildFromMap(pathParameters);
else
// just bail out since we don't have enough parameters, that must be an instance service
return;
if(rel.length() == 0){
if (m.isAnnotationPresent(GET.class))