List of usage examples for java.util Collections unmodifiableMap
public static <K, V> Map<K, V> unmodifiableMap(Map<? extends K, ? extends V> m)
From source file:org.kmnet.com.fw.common.codelist.AbstractReloadableCodeList.java
/** * Reloads the codelist./* w w w . j a va 2s . c o m*/ * @see org.kmnet.com.fw.common.codelist.ReloadableCodeList#refresh() */ @Override public final void refresh() { if (logger.isDebugEnabled()) { logger.debug("refresh codelist codeListId={}", getCodeListId()); } synchronized (cachedMap) { cachedMap.clearAndPutAll(retrieveMap()); exposedMap = Collections.unmodifiableMap(cachedMap); } }
From source file:com.thoughtworks.go.config.materials.AbstractMaterialConfig.java
@Override public final Map<String, Object> getSqlCriteria() { if (sqlCriteria == null) { Map<String, Object> map = new LinkedHashMap<>(); map.put("type", type); appendCriteria(map);//from ww w . ja v a 2 s . c om sqlCriteria = Collections.unmodifiableMap(map); } return sqlCriteria; }
From source file:com.arpnetworking.tsdaggregator.configuration.TsdAggregatorConfiguration.java
public Map<String, MetricsLimiter> getLimiters() { return Collections.unmodifiableMap(_limiters); }
From source file:channellistmaker.channelfilemaker.ChannelDocumentMaker.java
public ChannelDocumentMaker(Map<MultiKey<Integer>, Channel> channels) { Map<MultiKey<Integer>, Channel> temp = new ConcurrentHashMap<>(); temp.putAll(channels);//from w w w . j a v a 2s . c om this.channels = Collections.unmodifiableMap(temp); }
From source file:com.thoughtworks.go.config.materials.AbstractMaterial.java
public final Map<String, Object> getAttributesForScope() { Map<String, Object> map = new LinkedHashMap<>(); map.put("type", type); map.put("autoUpdate", isAutoUpdate()); appendCriteria(map);/* w ww .jav a 2 s.c o m*/ return Collections.unmodifiableMap(map); }
From source file:hr.fer.spocc.util.CharacterEscaper.java
/** * Creates an escaper which escapes with the specified character. * The <tt>from</tt> array is used to determine * which characters should be escaped, and the corresponding * element in the <tt>to</tt> array is used after the escape character * in the escaped string.//from w w w . j av a 2 s.com * * @param from the array of escapable characters * @param to the array of the escaped values for the escapable character * (order is relevant) * @param escapeCharacter the character used for escaping */ public CharacterEscaper(char[] from, char[] to, char escapeCharacter) { Validate.notNull(from); Validate.notNull(to); Validate.isTrue(from.length == to.length); Map<Character, Character> modifiableEscapeMap = new HashMap<Character, Character>(from.length); Map<Character, Character> modifiableUnescapeMap = new HashMap<Character, Character>(from.length); for (int i = 0; i < from.length; ++i) { Validate.isTrue(!modifiableEscapeMap.containsKey(from[i]) && !modifiableUnescapeMap.containsKey(to[i]), "Mapping must be a bijection"); modifiableEscapeMap.put(from[i], to[i]); modifiableUnescapeMap.put(to[i], from[i]); } // ensure that the escape character is also escaped Validate.isTrue(modifiableEscapeMap.containsKey(escapeCharacter), "Escape character must also be escapable"); this.escapeMap = Collections.unmodifiableMap(modifiableEscapeMap); this.unescapeMap = Collections.unmodifiableMap(modifiableUnescapeMap); this.escapeCharacter = escapeCharacter; }
From source file:ru.jts_dev.gameserver.parser.data.item.ItemDatasHolder.java
public final Map<Integer, ItemData> getItemData() { return Collections.unmodifiableMap(itemData); }
From source file:com.bstek.dorado.config.definition.Definition.java
private Map<String, Object> getOrCreateProperties() { if (properties == null) { properties = new HashMap<String, Object>(); unmodifiableProperties = Collections.unmodifiableMap(properties); }/*w w w .ja va 2 s.c o m*/ return properties; }
From source file:org.agiso.tempel.Tempel.java
public Tempel() { // Odczytujemy waciwoci systemowe i zapamitujemy je w mapie systemProperties: Properties properties = System.getProperties(); Map<String, Object> map = new HashMap<String, Object>(properties.size()); for (String key : properties.stringPropertyNames()) { map.put(key.replace('.', '_'), properties.getProperty(key)); }//from w w w .j av a 2 s .com systemProperties = Collections.unmodifiableMap(map); }
From source file:org.wise.vle.domain.webservice.http.AbstractHttpRequest.java
/** * Creates an AbstractHttpRequest object with all of the data required. * /*from w w w .j ava 2 s . c o m*/ * @param requestHeaders * is a map of HTTP request headers * @param requestParameters * is a map of HTTP request parameters * @param relativeUrl * is the target relative URL for this request * @param expectedResponseStatusCode * is the HTTP status code that is expected to be returned by the * server * @throws BadHeaderException * if the request headers contain any illegal characters either * in the request field name or the request field value */ protected AbstractHttpRequest(final Map<String, String> requestHeaders, final Map<String, String> requestParameters, final String relativeUrl, final int expectedResponseStatusCode) throws BadHeaderException { this.logger = LogFactory.getLog(this.getClass()); this.checkForLegalHeaders(requestHeaders); this.requestHeaders = Collections.unmodifiableMap(requestHeaders); this.requestParameters = Collections.unmodifiableMap(requestParameters); this.relativeUrl = relativeUrl; this.expectedResponseStatusCode = expectedResponseStatusCode; }