Example usage for java.util Locale ROOT

List of usage examples for java.util Locale ROOT

Introduction

In this page you can find the example usage for java.util Locale ROOT.

Prototype

Locale ROOT

To view the source code for java.util Locale ROOT.

Click Source Link

Document

Useful constant for the root locale.

Usage

From source file:net.pms.configuration.ProgramExecutableType.java

/**
 * Converts the string passed as an argument to a
 * {@link ProgramExecutableType}. If the conversion fails, {@code null} is
 * returned./*from  w  w  w.j  a  va 2  s .com*/
 *
 * @param executableType the {@link String} to convert.
 * @return The corresponding {@link ProgramExecutableType} or {@code null}.
 */
@Nullable
public static ProgramExecutableType toProgramExecutableType(@Nullable String executableType) {
    if (isBlank(executableType)) {
        return null;
    }
    switch (executableType.toLowerCase(Locale.ROOT)) {
    case "bundled":
        return BUNDLED;
    case "installed":
        return INSTALLED;
    case "custom":
        return CUSTOM;
    default:
        return null;
    }
}

From source file:com.grayfox.server.dao.PoiDaoTest.java

@Test
@Transactional//w  ww .j  av  a 2  s . c  om
public void testFetchNext() {
    Poi p1 = new Poi();
    p1.setFoursquareId("4bad0850f964a52082263be3");
    p1.setName("Cinpolis");
    p1.setLocation(Location.parse("19.032099226143384,-98.23300838470459"));
    Category category = new Category();
    category.setFoursquareId("4bf58dd8d48988d180941735");
    category.setName("Multicine");
    category.setIconUrl("https://ss3.4sqi.net/img/categories_v2/arts_entertainment/movietheater_88.png");
    p1.setCategories(new HashSet<>(Arrays.asList(category)));

    Poi p2 = new Poi();
    p2.setFoursquareId("4c2b7f8257a9c9b6affff567");
    p2.setName("Liverpool");
    p2.setLocation(Location.parse("19.03174044908608,-98.23100973086046"));
    category = new Category();
    category.setFoursquareId("4bf58dd8d48988d1f6941735");
    category.setName("Gran tienda");
    category.setIconUrl("https://ss3.4sqi.net/img/categories_v2/shops/departmentstore_88.png");
    p2.setCategories(new HashSet<>(Arrays.asList(category)));

    List<Poi> expectedPois = Arrays.asList(p1, p2);
    List<Poi> actualPois = poiDao.findNext("4c09270ea1b32d7f172297f0", 3, Locale.ROOT);

    assertThat(actualPois).isNotNull().isNotEmpty().doesNotContainNull().hasSameSizeAs(expectedPois)
            .containsExactlyElementsOf(expectedPois);
    assertThatThrownBy(() -> poiDao.findNext("invalidId", 3, Locale.ROOT)).isInstanceOf(DaoException.class);
}

From source file:com.gargoylesoftware.htmlunit.html.HtmlButton.java

/**
 * {@inheritDoc}//from  www.  j  av  a 2 s .c  o  m
 */
@Override
protected boolean doClickStateUpdate() throws IOException {
    final String type = getTypeAttribute().toLowerCase(Locale.ROOT);

    HtmlForm form = null;
    final String formId = getAttribute("form");
    if (DomElement.ATTRIBUTE_NOT_DEFINED == formId) {
        form = getEnclosingForm();
    } else {
        if (hasFeature(FORM_FORM_ATTRIBUTE_SUPPORTED)) {
            final DomElement elem = getHtmlPageOrNull().getElementById(formId);
            if (elem instanceof HtmlForm) {
                form = (HtmlForm) elem;
            }
        }
    }

    if (form != null) {
        if ("button".equals(type)) {
            return false;
        }

        if ("submit".equals(type)) {
            form.submit(this);
            return false;
        }

        if ("reset".equals(type)) {
            form.reset();
            return false;
        }

        form.submit(this);
        return false;
    }

    super.doClickStateUpdate();
    return false;
}

From source file:ch.algotrader.esper.SpringServiceResolver.java

String adjust(final String s) {
    for (int i = 0; i < s.length(); i++) {
        char ch = s.charAt(i);
        if (!Character.isUpperCase(ch)) {
            return s;
        }/*from  w ww . java2s.  c  o m*/
    }
    return s.toLowerCase(Locale.ROOT);
}

From source file:de.matzefratze123.heavyspleef.core.i18n.YMLControl.java

@Override
public List<Locale> getCandidateLocales(String baseName, Locale locale) {
    List<Locale> candidates = Lists.newArrayList();

    candidates.add(locale);//from ww w.  j  a  v  a2  s .  c  o  m

    if (!locale.getLanguage().isEmpty() && !locale.getCountry().isEmpty() && !locale.getVariant().isEmpty()) {
        candidates.add(new Locale(locale.getLanguage(), locale.getCountry()));
        candidates.add(new Locale(locale.getLanguage()));
    } else if (!locale.getLanguage().isEmpty() && !locale.getCountry().isEmpty()) {
        candidates.add(new Locale(locale.getLanguage()));
    }

    candidates.add(Locale.US);
    candidates.add(Locale.ROOT);
    return candidates;
}

From source file:ch.cyberduck.core.b2.B2AttributesFinderFeature.java

protected PathAttributes toAttributes(final B2FileResponse response) {
    final PathAttributes attributes = new PathAttributes();
    attributes.setSize(response.getContentLength());
    if (response.getFileInfo().containsKey(X_BZ_INFO_LARGE_FILE_SHA1)) {
        attributes.setChecksum(Checksum.parse(response.getFileInfo().get(X_BZ_INFO_LARGE_FILE_SHA1)));
    } else {//  w  ww  . j av  a 2  s  .  c  o  m
        attributes.setChecksum(Checksum.parse(StringUtils
                .removeStart(StringUtils.lowerCase(response.getContentSha1(), Locale.ROOT), "unverified:")));
    }
    final Map<String, String> metadata = new HashMap<>();
    for (Map.Entry<String, String> entry : response.getFileInfo().entrySet()) {
        metadata.put(entry.getKey(), entry.getValue());
    }
    attributes.setMetadata(metadata);
    attributes.setVersionId(response.getFileId());
    if (response.getFileInfo().containsKey(X_BZ_INFO_SRC_LAST_MODIFIED_MILLIS)) {
        attributes.setModificationDate(
                Long.valueOf(response.getFileInfo().get(X_BZ_INFO_SRC_LAST_MODIFIED_MILLIS)));
    }
    return attributes;
}

From source file:ch.cyberduck.core.Archive.java

/**
 * Factory//from   www  . j  a  va  2s.  c  o m
 *
 * @param name Identifier
 * @return Archive description
 */
public static Archive forName(final String name) {
    if (StringUtils.isNotBlank(name)) {
        for (Archive archive : getKnownArchives()) {
            for (String extension : archive.getExtensions()) {
                if (name.toLowerCase(Locale.ROOT).endsWith(extension.toLowerCase(Locale.ROOT))) {
                    return archive;
                }
            }
        }
    }
    log.fatal(String.format("Unknown archive %s", name));
    return null;
}

From source file:com.kpb.other.AcmeCorpPhysicalNamingStrategy.java

private LinkedList<String> splitAndReplace(String name) {
    LinkedList<String> result = new LinkedList<String>();
    for (String part : StringUtils.splitByCharacterTypeCamelCase(name)) {
        if (part == null || part.trim().isEmpty()) {
            // skip null and space
            continue;
        }//www .j  a  v a 2  s .  c o m
        part = applyAbbreviationReplacement(part);
        result.add(part.toLowerCase(Locale.ROOT));
    }
    return result;
}

From source file:com.gargoylesoftware.htmlunit.html.InputElementFactory.java

License:asdf

/**
 * {@inheritDoc}//from  w  w w  . ja  va2  s.  c o m
 */
@Override
public HtmlElement createElementNS(final SgmlPage page, final String namespaceURI, final String qualifiedName,
        final Attributes attributes, final boolean asdf) {

    Map<String, DomAttr> attributeMap = DefaultElementFactory.setAttributes(page, attributes);
    if (attributeMap == null) {
        attributeMap = new HashMap<>();
    }

    String type = null;
    if (attributes != null) {
        type = attributes.getValue("type");
    }
    if (type == null) {
        type = "";
    }

    final HtmlInput result;
    switch (type.toLowerCase(Locale.ROOT)) {
    case "":
        // This not an illegal value, as it defaults to "text"
        // cf http://www.w3.org/TR/REC-html40/interact/forms.html#adef-type-INPUT
        // and the common browsers seem to treat it as a "text" input so we will as well.
    case "text":
        result = new HtmlTextInput(qualifiedName, page, attributeMap);
        break;

    case "submit":
        result = new HtmlSubmitInput(qualifiedName, page, attributeMap);
        break;

    case "checkbox":
        result = new HtmlCheckBoxInput(qualifiedName, page, attributeMap);
        break;

    case "radio":
        result = new HtmlRadioButtonInput(qualifiedName, page, attributeMap);
        break;

    case "hidden":
        result = new HtmlHiddenInput(qualifiedName, page, attributeMap);
        break;

    case "password":
        result = new HtmlPasswordInput(qualifiedName, page, attributeMap);
        break;

    case "image":
        result = new HtmlImageInput(qualifiedName, page, attributeMap);
        break;

    case "reset":
        result = new HtmlResetInput(qualifiedName, page, attributeMap);
        break;

    case "button":
        result = new HtmlButtonInput(qualifiedName, page, attributeMap);
        break;

    case "file":
        result = new HtmlFileInput(qualifiedName, page, attributeMap);
        break;

    case "color":
        result = new HtmlColorInput(qualifiedName, page, attributeMap);
        break;

    case "date":
        result = new HtmlDateInput(qualifiedName, page, attributeMap);
        break;

    case "datetime-local":
        result = new HtmlDateTimeLocalInput(qualifiedName, page, attributeMap);
        break;

    case "month":
        result = new HtmlMonthInput(qualifiedName, page, attributeMap);
        break;

    case "number":
        result = new HtmlNumberInput(qualifiedName, page, attributeMap);
        break;

    case "range":
        result = new HtmlRangeInput(qualifiedName, page, attributeMap);
        break;

    case "search":
        result = new HtmlSearchInput(qualifiedName, page, attributeMap);
        break;

    case "time":
        result = new HtmlTimeInput(qualifiedName, page, attributeMap);
        break;

    case "week":
        result = new HtmlWeekInput(qualifiedName, page, attributeMap);
        break;

    default:
        LOG.info("Bad input type: \"" + type + "\", creating a text input");
        result = new HtmlTextInput(qualifiedName, page, attributeMap);
        break;
    }
    return result;
}

From source file:de.unentscheidbar.validation.DefaultMessageTextGetterTest.java

@Test
public void testDefaultMessageTexts() {

    Locale[] locales = { Locale.ROOT, Locale.GERMAN };

    Reflections r = new Reflections(new ConfigurationBuilder()
            .setUrls(ClasspathHelper.forPackage(ClassUtils.getPackageName(Validators.class)))
            .setScanners(new ResourcesScanner(), new SubTypesScanner(false)));

    Collection<Class<? extends Id>> defaultMessageClasses = Collections2.filter(
            r.getSubTypesOf(ValidationMessage.Id.class), Predicates.and(IS_NOT_ABSTRACT, IsTestClass.NO));
    Assert.assertTrue("Suspiciously few message ID classes found", defaultMessageClasses.size() > 10);

    MessageTextGetter mtg = Validation.defaultMessageTextGetter();

    for (Class<? extends Id> idClass : defaultMessageClasses) {
        /* only works with enums atm (all default message ids are enums) */
        if (!idClass.isEnum()) {
            Assert.fail("Cannot test " + idClass.getName());
        }//ww  w .j av  a 2  s. c o  m
        for (Id id : idClass.getEnumConstants()) {
            for (Locale locale : locales) {
                Assert.assertTrue("Missing default message text for " + locale + " -> "
                        + id.getClass().getName() + " -> " + id.name(), mtg.hasText(id, locale));
            }
        }
    }
}