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.cronutils.model.field.constraint.FieldConstraints.java

/**
 * @param specialChars//from  w ww  .  j  a va2s .  c  o m
 *            - allowed special chars
 * @param startRange
 *            - lowest possible value
 * @param endRange
 *            - highest possible value
 */
public FieldConstraints(Map<String, Integer> stringMapping, Map<Integer, Integer> intMapping,
        Set<SpecialChar> specialChars, int startRange, int endRange) {
    this.stringMapping = Collections
            .unmodifiableMap(Validate.notNull(stringMapping, "String mapping must not be null"));
    this.intMapping = Collections
            .unmodifiableMap(Validate.notNull(intMapping, "Integer mapping must not be null"));
    this.specialChars = Collections.unmodifiableSet(
            Validate.notNull(specialChars, "Special (non-standard) chars set must not be null"));
    this.startRange = startRange;
    this.endRange = endRange;
}

From source file:com.joyent.manta.util.LookupMap.java

/**
 * Creates a new instance of a lookup map backed by the specified map.
 *
 * @param backingMap map to back lookup map
 *//*from   w  w  w.j  a  v  a2 s  . co  m*/
public LookupMap(final Map<String, V> backingMap) {
    if (isUnmodifiable(backingMap)) {
        this.wrapped = backingMap;
    } else {
        this.wrapped = Collections.unmodifiableMap(backingMap);
    }
    this.lowercaseWrapped = new CaseInsensitiveMap<>(this.wrapped);
}

From source file:com.opengamma.engine.function.resolver.SimpleResolutionRuleTransform.java

/**
 * Gets the map of registered transformations.
 * <p>/*from  w w w .  ja va  2 s .co  m*/
 * The map is keyed by short function name, with the value being the the action to be applied.
 * If multiple actions are applied, the function will be advertised by multiple new rules in
 * place of the original. If a function is omitted from the set, the original rule is preserved.
 * 
 * @return the set of transformations, not null
 */
public Map<String, Action> getFunctionTransformations() {
    return Collections.unmodifiableMap(_functionTransformations);
}

From source file:org.onehippo.forge.solr.indexer.task.SolrConfiguration.java

/**
 * Validate solr filter properties (skip invalid properties)
 * @param solrFilterProperties Solr filter properties
 * @return Solr filter properties/* w ww . ja  v  a  2  s.  c om*/
 */
public static Map<String, String> validateSolrFilterProperties(Map<String, String> solrFilterProperties) {
    Map<String, String> solrFilterPropertiesValid = new HashMap<String, String>();
    for (Entry<String, String> property : solrFilterProperties.entrySet()) {
        String key = StringUtils.trimToNull(property.getKey());
        String value = StringUtils.trimToNull(property.getValue());
        if (key == null || value == null || WRONG_CHARACTER_PATTERN_FOR_SOLR_ID.matcher(key).find()) {
            log.warn("Skip invalid Solr filter property: {}", property);
        } else {
            solrFilterPropertiesValid.put(key, value);
        }
    }
    return Collections.unmodifiableMap(solrFilterPropertiesValid);
}

From source file:nl.clockwork.common.PropertyPlaceholderConfigurer.java

public Map<String, String> getProperties() {
    return Collections.unmodifiableMap(properties);
}

From source file:com.wantscart.jade.provider.Definition.java

public Definition(Class<?> clazz) {
    this.clazz = clazz;
    Type[] genTypes = clazz.getGenericInterfaces();
    if (ArrayUtils.isNotEmpty(genTypes)) {
        Type[] params = ((ParameterizedType) genTypes[0]).getActualTypeArguments();
        if (params.length > 0) {
            this.genericsClazz = (Class<?>) params[0];
        } else {/*from ww w  .  j ava2 s . co m*/
            this.genericsClazz = null;
        }
    } else {
        this.genericsClazz = null;
    }
    this.constants = Collections.unmodifiableMap( // NL
            GenericUtils.getConstantFrom(clazz, true, true));
}

From source file:gov.nasa.ensemble.core.jscience.xml.XMLProfilesResource.java

private static Map<Object, Object> createSaveOptions() {
    Map<Object, Object> map = new LinkedHashMap<Object, Object>();
    map.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
    return Collections.unmodifiableMap(map);
}

From source file:org.slc.sli.ingestion.util.ExposedPropertyPlaceholderConfigurer.java

@Override
protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)
        throws BeansException {
    Map<String, String> tmpProperties = new HashMap<String, String>(props.size());
    super.processProperties(beanFactoryToProcess, props);
    for (Entry<Object, Object> entry : props.entrySet()) {
        tmpProperties.put(String.valueOf(entry.getKey()), String.valueOf(entry.getValue()));
    }/*from   w  w  w . j  a  v  a2 s .c om*/
    this.properties = Collections.unmodifiableMap(tmpProperties);
}

From source file:io.wcm.caravan.io.http.request.Request.java

Request(String method, String url, Map<String, Collection<String>> headers, byte[] body, Charset charset) {
    this.method = checkNotNull(method, "method of %s", url);
    this.url = checkNotNull(url, "url");
    LinkedHashMap<String, Collection<String>> copyOf = new LinkedHashMap<String, Collection<String>>();
    copyOf.putAll(checkNotNull(headers, "headers of %s %s", method, url));
    this.headers = Collections.unmodifiableMap(copyOf);

    this.body = body; // nullable
    this.charset = charset; // nullable
}

From source file:com.doculibre.constellio.utils.SimpleParamsHttpServletRequestWrapper.java

@SuppressWarnings("unchecked")
@Override/* www  .  j  a v  a2s.  c om*/
public Map getParameterMap() {
    Map<String, String[]> paramsMap = new HashMap<String, String[]>();
    for (String paramName : simpleParams.keySet()) {
        paramsMap.put(paramName, simpleParams.getList(paramName).toArray(new String[0]));
    }
    return Collections.unmodifiableMap(paramsMap);
}