Example usage for java.util ResourceBundle getBundle

List of usage examples for java.util ResourceBundle getBundle

Introduction

In this page you can find the example usage for java.util ResourceBundle getBundle.

Prototype

@CallerSensitive
public static final ResourceBundle getBundle(String baseName) 

Source Link

Document

Gets a resource bundle using the specified base name, the default locale, and the caller module.

Usage

From source file:edu.harvard.iq.dataverse.DatasetFieldCompoundValue.java

public Map<DatasetField, String> getDisplayValueMap() {
    // todo - this currently only supports child datasetfields with single values
    // need to determine how we would want to handle multiple
    Map<DatasetField, String> fieldMap = new LinkedHashMap<>();

    for (DatasetField childDatasetField : childDatasetFields) {
        // skip the value if it is empty or N/A
        if (!StringUtils.isBlank(childDatasetField.getValue())
                && !DatasetField.NA_VALUE.equals(childDatasetField.getValue())) {
            String format = childDatasetField.getDatasetFieldType().getDisplayFormat();
            if (StringUtils.isBlank(format)) {
                format = "#VALUE";
            }//from  w  w  w . ja  va 2 s  .  co  m
            String sanitizedValue = childDatasetField.getDatasetFieldType().isSanitizeHtml()
                    ? MarkupChecker.sanitizeBasicHTML(childDatasetField.getValue())
                    : childDatasetField.getValue();
            if (!childDatasetField.getDatasetFieldType().isSanitizeHtml()
                    && childDatasetField.getDatasetFieldType().isEscapeOutputText()) {
                sanitizedValue = MarkupChecker.stripAllTags(sanitizedValue);
            }
            // replace the special values in the format (note: we replace #VALUE last since we don't
            // want any issues if the value itself has #NAME in it)
            String displayValue = format.replace("#NAME", childDatasetField.getDatasetFieldType().getTitle())
                    //todo: this should be handled in more generic way for any other text that can then be internationalized
                    // if we need to use replaceAll for regexp, then make sure to use: java.util.regex.Matcher.quoteReplacement(<target string>)
                    .replace("#EMAIL",
                            ResourceBundle.getBundle("Bundle").getString("dataset.email.hiddenMessage"))
                    .replace("#VALUE", sanitizedValue);

            fieldMap.put(childDatasetField, displayValue);
        }
    }

    return fieldMap;
}

From source file:com.socrata.ApiBase.java

/**
 * Loads necessary connection details from disk.
 *///from   w w w  .  java 2s . c om
private void loadProperties() {
    this.properties = ResourceBundle.getBundle("com.socrata.resources");
    this.httpClient = new DefaultHttpClient();
}