/** * This method initialises the list of URI information. * * @param uris The URI information */ protected static void initURIInfo(List<URIInfo> uris) { for (int i = 0; i < uris.size(); i++) { URIInfo info = uris.get(i); info.setRegex(createRegex(info.getUri(), info.metaURI())); if (info.metaURI()) { StringBuilder template = new StringBuilder(); String[] parts = info.getUri().split("/"); String part = null; int paramNo = 1; for (int j = 1; j < parts.length; j++) { template.append("/"); if (parts[j].equals("*")) { if (part == null) { template.append("{"); template.append("param"); template.append(paramNo++); template.append("}"); } else { // Check if plural if (part.length() > 1 && part.charAt(part.length() - 1) == 's') { part = part.substring(0, part.length() - 1); } template.append("{"); template.append(part); template.append("Id}"); } part = null; } else { part = parts[j]; template.append(part); } } info.setTemplate(template.toString()); } } }