test_class.file: base/lang/src/test/java/leap/lang/LocalesTest.java
test_class.identifier: LocalesTest
test_class.superclass: extends TestBase
test_case.body: @Test
  	public void testForName(){
  		Locale locale = Locales.forName("en");
  		assertNotNull(locale);
  		assertEquals("en", locale.toString());
  		
  		locale = Locales.forName("zh");
  		assertNotNull(locale);
  		assertEquals("zh", locale.toString());
  		
  		locale = Locales.forName("zh_CN");
  		assertNotNull(locale);
  		assertEquals("zh_CN", locale.toString());
  	}
test_case.class_method_signature: LocalesTest.testForName()
test_case.full_signature: @Test public void testForName()
test_case.identifier: testForName
test_case.invocations: forName assertNotNull assertEquals toString forName assertNotNull assertEquals toString forName assertNotNull assertEquals toString
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testForName()
focal_class.declarator: DEFAULT_LOCALE = Locale.getDefault()
focal_class.modifier: public static final
focal_class.original_string: public static final Locale DEFAULT_LOCALE = Locale.getDefault();
focal_class.type: Locale
focal_class.var_name: DEFAULT_LOCALE
focal_class.file: base/lang/src/main/java/leap/lang/Locales.java
focal_class.identifier: Locales
focal_class.class_method_signature: Locales.toName(Locale locale)
focal_class.full_signature: public static String toName(Locale locale)
focal_class.identifier: toName
focal_class.modifiers: public static
focal_class.parameters: (Locale locale)
focal_class.return: String
focal_class.signature: String toName(Locale locale)
focal_class.class_method_signature: Locales.tryForName(String localName)
focal_class.full_signature: public static Locale tryForName(String localName)
focal_class.identifier: tryForName
focal_class.modifiers: public static
focal_class.parameters: (String localName)
focal_class.return: Locale
focal_class.signature: Locale tryForName(String localName)
focal_class.class_method_signature: Locales.forName(String localeName)
focal_class.full_signature: public static Locale forName(String localeName)
focal_class.identifier: forName
focal_class.modifiers: public static
focal_class.parameters: (String localeName)
focal_class.return: Locale
focal_class.signature: Locale forName(String localeName)
focal_class.class_method_signature: Locales.extractFromFilename(String filename)
focal_class.full_signature: public static String extractFromFilename(String filename)
focal_class.identifier: extractFromFilename
focal_class.modifiers: public static
focal_class.parameters: (String filename)
focal_class.return: String
focal_class.signature: String extractFromFilename(String filename)
focal_class.class_method_signature: Locales.getLocalePaths(Locale locale, String path)
focal_class.full_signature: public static String[] getLocalePaths(Locale locale, String path)
focal_class.identifier: getLocalePaths
focal_class.modifiers: public static
focal_class.parameters: (Locale locale, String path)
focal_class.return: String[]
focal_class.signature: String[] getLocalePaths(Locale locale, String path)
focal_class.class_method_signature: Locales.getLocalePaths(Locale locale, String path,String suffix)
focal_class.full_signature: public static String[] getLocalePaths(Locale locale, String path,String suffix)
focal_class.identifier: getLocalePaths
focal_class.modifiers: public static
focal_class.parameters: (Locale locale, String path,String suffix)
focal_class.return: String[]
focal_class.signature: String[] getLocalePaths(Locale locale, String path,String suffix)
focal_class.class_method_signature: Locales.getLocaleFilePaths(Locale locale, String filePath)
focal_class.full_signature: public static String[] getLocaleFilePaths(Locale locale, String filePath)
focal_class.identifier: getLocaleFilePaths
focal_class.modifiers: public static
focal_class.parameters: (Locale locale, String filePath)
focal_class.return: String[]
focal_class.signature: String[] getLocaleFilePaths(Locale locale, String filePath)
focal_class.class_method_signature: Locales.Locales()
focal_class.full_signature: protected  Locales()
focal_class.identifier: Locales
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.signature:  Locales()
focal_method.body: public static Locale forName(String localeName) {
  		Args.notEmpty(localeName,"locale name");
          int len = localeName.length();
          if (len != 2 && len != 5 && len < 7) {
              throw new IllegalArgumentException("Invalid locale format: " + localeName);
          }
          char ch0 = localeName.charAt(0);
          char ch1 = localeName.charAt(1);
          if (ch0 < 'a' || ch0 > 'z' || ch1 < 'a' || ch1 > 'z') {
              throw new IllegalArgumentException("Invalid locale format: " + localeName);
          }
          if (len == 2) {
              return new Locale(localeName, "");
          } else {
              if (localeName.charAt(2) != '_') {
                  throw new IllegalArgumentException("Invalid locale format: " + localeName);
              }
              char ch3 = localeName.charAt(3);
              if (ch3 == '_') {
                  return new Locale(localeName.substring(0, 2), "", localeName.substring(4));
              }
              char ch4 = localeName.charAt(4);
              if (ch3 < 'A' || ch3 > 'Z' || ch4 < 'A' || ch4 > 'Z') {
                  throw new IllegalArgumentException("Invalid locale format: " + localeName);
              }
              if (len == 5) {
                  return new Locale(localeName.substring(0, 2), localeName.substring(3, 5));
              } else {
                  if (localeName.charAt(5) != '_') {
                      throw new IllegalArgumentException("Invalid locale format: " + localeName);
                  }
                  return new Locale(localeName.substring(0, 2), localeName.substring(3, 5), localeName.substring(6));
              }
          }
  	}
focal_method.class_method_signature: Locales.forName(String localeName)
focal_method.full_signature: public static Locale forName(String localeName)
focal_method.identifier: forName
focal_method.invocations: notEmpty length charAt charAt charAt charAt substring substring charAt substring substring charAt substring substring substring
focal_method.modifiers: public static
focal_method.parameters: (String localeName)
focal_method.return: Locale
focal_method.signature: Locale forName(String localeName)