Example usage for java.util Collections unmodifiableMap

List of usage examples for java.util Collections unmodifiableMap

Introduction

In this page you can find the example usage for java.util Collections unmodifiableMap.

Prototype

public static <K, V> Map<K, V> unmodifiableMap(Map<? extends K, ? extends V> m) 

Source Link

Document

Returns an unmodifiable view of the specified map.

Usage

From source file:com.amazon.speech.slu.Intent.java

/**
 * Private constructor to return a new {@code Intent} from a {@code Builder}.
 *
 * @param builder/*w w  w  . ja  va  2s. c  om*/
 *            the builder used to construct the {@code Intent}.
 */
private Intent(final Builder builder) {
    name = builder.name;
    slots = Collections.unmodifiableMap(builder.slots);
}

From source file:kina.config.EntityCassandraKinaConfig.java

/**
 * {@inheritDoc}/*from w  w w.  j av  a2s . co m*/
 */
@Override
public CassandraKinaConfig<T> initialize() {
    super.initialize();

    Map<String, String> tmpMap = new HashMap<>();

    Field[] kinaFields = CassandraUtils.filterKinaFields(entityClass);

    for (Field f : kinaFields) {
        String dbName = CassandraUtils.kinaFieldName(f);
        String beanFieldName = f.getName();

        tmpMap.put(dbName, beanFieldName);
    }

    mapDBNameToEntityName = Collections.unmodifiableMap(tmpMap);

    return this;
}

From source file:com.xylocore.copybook.generator.EnvironmentConfigurator.java

/**
 * FILLIN
 * 
 * @return
 */
public Map<String, String> getOverrideProperties() {
    return Collections.unmodifiableMap(overrideProperties);
}

From source file:net.paoding.rose.web.var.ModelImpl.java

public Map<String, Object> getAttributes() {
    final Map<String, Object> cloneAndFiltered = new HashMap<String, Object>(map.size() * 2);
    synchronized (mutex) {
        final Iterator<Map.Entry<String, Object>> iterator = map.entrySet().iterator();
        while (iterator.hasNext()) {
            final Map.Entry<String, Object> entry = iterator.next();
            final String key = entry.getKey();
            if (key != null && !key.startsWith("$$paoding-rose")) {
                cloneAndFiltered.put(key, entry.getValue());
            }/*from   ww  w .j a  v  a  2s  .  c  o  m*/
        }
    }
    return Collections.unmodifiableMap(cloneAndFiltered);
}

From source file:ar.com.zauber.labs.kraken.providers.wikipedia.model.impl.SimpleWikiPage.java

/** Creates the SimpleWikiPage. */
public SimpleWikiPage(final long pageId, final Language lang, final Set<String> titles,
        final Map<Language, WikiPage> langTitles) {

    Validate.notNull(lang, "null language");
    Validate.notNull(titles, "null titles");
    Validate.isTrue(titles.size() > 0, "wiki page must have at least one title");
    for (final String title : titles) {
        Validate.isTrue(StringUtils.isNotBlank(title), "invalid title");
    }/*from   www.ja va  2  s. c  om*/

    for (final Map.Entry<Language, WikiPage> langTitle : langTitles.entrySet()) {
        Validate.notNull(langTitle.getKey());
        Validate.notNull(langTitle.getValue());
    }

    this.pageId = pageId;
    this.lang = lang;
    this.titles = Collections.unmodifiableSet(titles);
    this.langTitles = Collections.unmodifiableMap(langTitles);
}

From source file:ru.jts_dev.gameserver.parser.impl.UserBasicActionsHolder.java

public Map<Integer, Action> getActionsData() {
    return Collections.unmodifiableMap(actionsData);
}

From source file:io.pivotal.dataflow.task.app.jdbcgemfire.GemfireDozerItemWriterTestUtil.java

public static Map<String, Map<String, Object>> createDataSet() {
    Map<String, Map<String, Object>> dataSet = new HashMap<>();
    dataSet.put("RoyaltySchedule", createRoyaltyScheduleMap());
    dataSet.put("Sale", createSalesMap());
    dataSet.put("SalesDetail", createSalesDetailMap());
    dataSet.put("Title", createTitlesMap());
    dataSet.put("TitleAuthor", createTitleAuthorsMap());
    dataSet.put("TitleEditor", createTitleEditorsMap());
    dataSet.put("Publisher", createPublisherMap());
    dataSet.put("Author", createAuthorsMap());

    return Collections.unmodifiableMap(dataSet);
}

From source file:com.google.code.activetemplates.impl.handlers.BuiltinHandlerSPI.java

public Map<QName, AttributeHandler> getAttributeHandlers() {
    return Collections.unmodifiableMap(attributes);
}

From source file:com.diffeo.dossier.fc.StringCounter.java

/**
 * Get the dictionary of strings and counts.
 *
 * If the feature is read-only, the returned map is unmodifiable.
 * Otherwise it can be changed freely.//from   w  w w  . j a  v a  2  s  .co m
 *
 * @return  Map from string name to integer count
 */
@JsonValue
public Map<String, Integer> getStrings() {
    if (readOnly) {
        return Collections.unmodifiableMap(strings);
    } else {
        return strings;
    }
}

From source file:com.trenako.criteria.SearchCriteria.java

/**
 * Returns an immutable copy of the provided {@code SearchCriteria}.
 * <p>//from   w  ww. ja  v  a  2s.c om
 * Only read operations are allowed; any attempt to modify the returned
 * {@code SearchCriteria} will result in an {@code UnsupportedOperationException}.
 * </p>
 *
 * @param sc the original {@code SearchCriteria}
 * @return an immutable object
 */
public static SearchCriteria immutableSearchCriteria(SearchCriteria sc) {
    return new SearchCriteria(Collections.unmodifiableMap(sc.values));
}