/** * This implementation returns the name of the file that this class path * resource refers to. * @see org.springframework.util.StringUtils#getFileName(String) */ @Override public String getFilename() { return Paths.getFileName(this.path); }
String filename = Paths.getFileNameWithoutExtension(Paths.getFileName(relativePath)); String entityName = Strings.substringBefore(relativePath, "/"); String localeName = Locales.extractFromFilename(filename);
/** * This implementation returns the name of the file that this ServletContext * resource refers to. * @see org.springframework.util.StringUtils#getFilename(String) */ @Override public String getFilename() { return Paths.getFileName(this.path); }
private int comparePaths(String p1, String p2) { String dir1 = Paths.getDirPath(p1); String dir2 = Paths.getDirPath(p2); String file1 = Paths.getFileName(p1); String file2 = Paths.getFileName(p2); if(dir1.equals(dir2)) { return result(file1.compareTo(file2)); }else if(dir1.startsWith(dir2)) { return -1; }else if(dir2.startsWith(dir1)) { return 1; }else { return result(dir1.compareTo(dir2)); } }
private void read(MetaApi api, boolean global, String path, Map<String, Object> map) { MetaTag tag = Converts.convert(map, MetaTag.class); if(!global) { if(Strings.isEmpty(tag.getName())) { tag.setName(Paths.getFileName(path)); } MetaTag existence = api.getTags().get(tag.getName()); if(null == existence) { tag.addPath(path); api.addTag(tag); }else { existence.addPath(path); if (null == existence.getDescription()) { existence.setDescription(tag.getDescription()); } } }else { if(api.getTags().get(tag.getName()) != null) { throw new IllegalStateException("Tag '" + tag.getName() + "' already exists!"); } api.addTag(tag); } }