mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (javadoc; test)
https://github.com/JetBrains/intellij-community/pull/273
This commit is contained in:
committed by
Roman Shevchenko
parent
deca553e22
commit
4b4671f860
@@ -281,6 +281,18 @@ public class StringUtil extends StringUtilRt {
|
||||
return getPackageName(fqName, '.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a fqName returns the package name for the type or the containing type.
|
||||
* <p/>
|
||||
* <ul>
|
||||
* <li><code>java.lang.String</code> -> <code>java.lang</code></li>
|
||||
* <li><code>java.util.Map.Entry</code> -> <code>java.util.Map</code></li>
|
||||
* </ul>
|
||||
*
|
||||
* @param fqName a fully qualified type name. Not supposed to contain any type arguments
|
||||
* @param separator the separator to use. Typically '.'
|
||||
* @return the package name of the type or the declarator of the type. The empty string if the given fqName is unqualified
|
||||
*/
|
||||
@NotNull
|
||||
@Contract(pure = true)
|
||||
public static String getPackageName(@NotNull String fqName, char separator) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -380,4 +380,11 @@ public class StringUtilTest extends TestCase {
|
||||
assertEquals("<![CDATA[abcd]]]><![CDATA[]>efgh]]>", XmlStringUtil.wrapInCDATA("abcd]]>efgh"));
|
||||
assertEquals("<![CDATA[123<![CDATA[wow<&>]]]><![CDATA[]>]]]><![CDATA[]><![CDATA[123]]>", XmlStringUtil.wrapInCDATA("123<![CDATA[wow<&>]]>]]><![CDATA[123"));
|
||||
}
|
||||
|
||||
public void testGetPackageName() {
|
||||
assertEquals("java.lang", StringUtil.getPackageName("java.lang.String"));
|
||||
assertEquals("java.util.Map", StringUtil.getPackageName("java.util.Map.Entry"));
|
||||
assertEquals("Map", StringUtil.getPackageName("Map.Entry"));
|
||||
assertEquals("", StringUtil.getPackageName("Number"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user