2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.common;
10 import com.google.common.annotations.Beta;
11 import java.util.AbstractMap.SimpleEntry;
12 import java.util.Map.Entry;
15 * Utility class for handling various naming conventions mentioned in YANG and related specifications.
17 * @author Robert Varga
20 public final class YangNames {
22 throw new UnsupportedOperationException();
26 * Parse a file name according to rules outlined in https://tools.ietf.org/html/rfc6020#section-5.2. Input string
27 * should be the base path with file extension stripped.
29 * @param baseName file base name
30 * @return A tuple containing the module name and parsed revision, if present.
32 public static Entry<String, String> parseFilename(final String baseName) {
33 final int zavinac = baseName.lastIndexOf('@');
35 return new SimpleEntry<>(baseName, null);
38 return new SimpleEntry<>(baseName.substring(0, zavinac), baseName.substring(zavinac + 1));