@Test public void detects_resoure_paths() { assertTrue(isResourcePath("/some/parrots")); assertTrue(isResourcePath("/")); assertTrue(isResourcePath("/some/parrots/")); assertFalse(isResourcePath("/some/parrots/{parrotId}")); assertFalse(isResourcePath("/some/parrots/{parrotId}/")); assertTrue(isResourcePath("/some/parrots/{parrotId}/feather")); assertTrue(isResourcePath("/some/parrots/{parrotId}/feather/")); }
public static boolean isResourcePath(String path) { String[] fragments = path.split("/"); if (fragments.length == 0) { return true; } return !isVariable(fragments[fragments.length - 1]); }
PathUtils { public static boolean isResourcePath(String path) { String[] fragments = path.split("/"); if (fragments.length == 0) { return true; } return !isVariable(fragments[fragments.length - 1]); } }
PathUtils { public static boolean isResourcePath(String path) { String[] fragments = path.split("/"); if (fragments.length == 0) { return true; } return !isVariable(fragments[fragments.length - 1]); } private  PathUtils(); }
PathUtils { public static boolean isResourcePath(String path) { String[] fragments = path.split("/"); if (fragments.length == 0) { return true; } return !isVariable(fragments[fragments.length - 1]); } private  PathUtils(); static boolean isVariable(String fragment); static boolean checkPath(String path, Predicate<String> segmentChecker); static boolean isSpinalCase(String fragment); static boolean isResourcePath(String path); static String terminalSegment(String path); static String trimTrailingSlash(String path); }
PathUtils { public static boolean isResourcePath(String path) { String[] fragments = path.split("/"); if (fragments.length == 0) { return true; } return !isVariable(fragments[fragments.length - 1]); } private  PathUtils(); static boolean isVariable(String fragment); static boolean checkPath(String path, Predicate<String> segmentChecker); static boolean isSpinalCase(String fragment); static boolean isResourcePath(String path); static String terminalSegment(String path); static String trimTrailingSlash(String path); static final Pattern SPINAL_CASE_PATTERN; }