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:com.haulmont.cuba.gui.ScreensHelper.java
protected Map<String, Object> getAvailableScreensMap(Class entityClass, ScreenType filterScreenType) { String key = getScreensCacheKey(entityClass.getName(), getUserLocale(), filterScreenType); Map<String, Object> screensMap = availableScreensCache.get(key); if (screensMap != null) { return screensMap; }//from w ww .j a v a2s . c o m Collection<WindowInfo> windowInfoCollection = windowConfig.getWindows(); screensMap = new TreeMap<>(); Set<String> visitedWindowIds = new HashSet<>(); for (WindowInfo windowInfo : windowInfoCollection) { String windowId = windowInfo.getId(); // just skip for now, we assume all versions of screen can operate with the same entity if (visitedWindowIds.contains(windowId)) { continue; } String src = windowInfo.getTemplate(); if (StringUtils.isNotEmpty(src)) { try { Element windowElement = getWindowElement(src); if (windowElement != null) { if (isEntityAvailable(windowElement, entityClass, filterScreenType)) { String caption = getScreenCaption(windowElement, src); caption = getDetailedScreenCaption(caption, windowId); screensMap.put(caption, windowId); } } else { screensMap.put(windowId, windowId); } } catch (FileNotFoundException e) { log.error(e.getMessage()); } } visitedWindowIds.add(windowId); } screensMap = Collections.unmodifiableMap(screensMap); cacheScreens(key, screensMap); return screensMap; }
From source file:org.wisdom.wamp.WampController.java
@Invalidate public synchronized void stop() { clients = Collections.unmodifiableMap(new HashMap<String, WampClient>()); registry = Collections.unmodifiableMap(new HashMap<String, ExportedService>()); }
From source file:com.smartitengineering.cms.api.common.MediaType.java
public MediaType(String type, String subtype, Map<String, String> parameters) { this.type = type == null ? MEDIA_TYPE_WILDCARD : type; this.subtype = subtype == null ? MEDIA_TYPE_WILDCARD : subtype; if (parameters == null) { this.parameters = Collections.emptyMap(); } else {//from w w w .ja va 2s .com Map<String, String> map = new TreeMap<String, String>(new StringComparator()); for (Map.Entry<String, String> entry : parameters.entrySet()) { map.put(entry.getKey().toLowerCase(), entry.getValue()); } this.parameters = Collections.unmodifiableMap(map); } }
From source file:cmd.InputHandler.java
public Map<String, String> getStringDataTypes() { return Collections.unmodifiableMap(stringDataTypes); }
From source file:io.cloudslang.lang.runtime.bindings.LoopsBindingTest.java
@Test public void whenValueIsThereItWillBeReturned() throws Exception { Context context = mock(Context.class); ArrayList<Value> result = Lists.newArrayList(ValueFactory.create(1)); when(scriptEvaluator.evalExpr(anyString(), anyMapOf(String.class, Value.class), eq(EMPTY_SET), eq(EMPTY_FUNCTION_SET))).thenReturn(ValueFactory.create(result)); Map<String, Value> langVars = new HashMap<>(); ForLoopCondition forLoopCondition = new ForLoopCondition(result); langVars.put(LoopCondition.LOOP_CONDITION_KEY, ValueFactory.create(forLoopCondition)); when(context.getLanguageVariable(LoopCondition.LOOP_CONDITION_KEY)) .thenReturn(langVars.get(LoopCondition.LOOP_CONDITION_KEY)); when(context.getImmutableViewOfLanguageVariables()).thenReturn(Collections.unmodifiableMap(langVars)); loopsBinding.getOrCreateLoopCondition(createBasicForStatement(), context, EMPTY_SET, "node"); Assert.assertEquals(true,//from ww w .j a v a 2 s . c om context.getImmutableViewOfLanguageVariables().containsKey(LoopCondition.LOOP_CONDITION_KEY)); Assert.assertEquals(forLoopCondition, context.getImmutableViewOfLanguageVariables().get(LoopCondition.LOOP_CONDITION_KEY).get()); }
From source file:cn.homecredit.web.listener.MyOsgiHost.java
@Override public Map<String, Bundle> getActiveBundles() { Map<String, Bundle> bundles = new HashMap<String, Bundle>(); for (Bundle bundle : felix.getBundleContext().getBundles()) { if (bundle.getState() == Bundle.ACTIVE) { bundles.put(bundle.getSymbolicName(), bundle); }/*www . ja v a 2 s .co m*/ } return Collections.unmodifiableMap(bundles); }
From source file:gaffer.store.schema.SchemaElementDefinition.java
@JsonGetter("properties") public Map<String, String> getPropertyMap() { return Collections.unmodifiableMap(properties); }
From source file:com.cloudera.flume.reporter.ReportEvent.java
/** * Returns an unmodifiable map of all double metrics *//*from w ww . j a v a2 s .c o m*/ public Map<String, Double> getAllDoubleMetrics() { return Collections.unmodifiableMap(doubleMetrics); }
From source file:com.flexive.core.search.cmis.impl.sql.generic.GenericSelectedTableVisitor.java
/** {@inheritDoc} */ @Override public Map<TableReference, String> getTableAliases() { return Collections.unmodifiableMap(tableAliases); }
From source file:de.blizzy.documentr.system.SystemSettingsStore.java
public Map<String, String> getSettings() { synchronized (settings) { return Collections.unmodifiableMap(Maps.newHashMap(settings)); } }