Here you can find the source of getQualifiedName(String outputDir, Path path)
Parameter | Description |
---|---|
outputDir | a parameter |
path | a parameter |
public static String getQualifiedName(String outputDir, Path path)
//package com.java2s; /*/*from w w w . j a v a 2s . c o m*/ * ****************************************************************************** * MontiCore Language Workbench * Copyright (c) 2015, MontiCore, All rights reserved. * * This project is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this project. If not, see <http://www.gnu.org/licenses/>. * ****************************************************************************** */ import java.nio.file.Path; public class Main { /** Returns a dot separated name of the file represented by the given path without its fileextension * Example: outputdir is /a/b and path represents /a/b/c/d/e.txt * returns "c.d.e" * * @param outputDir * @param path * @return */ public static String getQualifiedName(String outputDir, Path path) { StringBuilder qualifiedName = new StringBuilder(path.getName(0) .toString()); for (int i = 1; i < path.getNameCount() - 1; i++) { qualifiedName.append("."); qualifiedName.append(path.getName(i)); } if (path.getFileName() != null) { String[] seperatedFileName = path.getFileName().toString() .split("\\."); qualifiedName.append("." + seperatedFileName[0]); } return qualifiedName.toString(); } }