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.apache.juneau.rest.client.RestClient.java
RestClient(PropertyStore propertyStore, CloseableHttpClient httpClient, boolean keepHttpClientOpen, Serializer serializer, Parser parser, UrlEncodingSerializer urlEncodingSerializer, PartSerializer partSerializer, Map<String, String> headers, List<RestCallInterceptor> interceptors, String rootUri, RetryOn retryOn, int retries, long retryInterval, boolean debug, ExecutorService executorService, boolean executorServiceShutdownOnClose) { super(propertyStore); this.httpClient = httpClient; this.keepHttpClientOpen = keepHttpClientOpen; this.serializer = serializer; this.parser = parser; this.urlEncodingSerializer = urlEncodingSerializer; this.partSerializer = partSerializer; Map<String, String> h2 = new ConcurrentHashMap<String, String>(headers); this.headers = Collections.unmodifiableMap(h2); this.rootUrl = rootUri; this.retryOn = retryOn; this.retries = retries; this.retryInterval = retryInterval; this.debug = debug; List<RestCallInterceptor> l = new ArrayList<RestCallInterceptor>(interceptors); if (debug)/* w w w . j a va 2s . co m*/ l.add(RestCallLogger.DEFAULT); this.interceptors = l.toArray(new RestCallInterceptor[l.size()]); if (Boolean.getBoolean("org.apache.juneau.rest.client.RestClient.trackLifecycle")) creationStack = Thread.currentThread().getStackTrace(); else creationStack = null; this.executorService = executorService; this.executorServiceShutdownOnClose = executorServiceShutdownOnClose; }
From source file:com.cloudera.flume.handlers.thrift.ThriftEventAdaptor.java
@Override public Map<String, byte[]> getAttrs() { if (evt.fields == null) { return Collections.<String, byte[]>emptyMap(); }/*w w w . j a v a 2s. c o m*/ Map<String, ByteBuffer> tempMap = Collections.unmodifiableMap(evt.fields); Map<String, byte[]> returnMap = new HashMap<String, byte[]>(); for (String key : tempMap.keySet()) { ByteBuffer buf = tempMap.get(key); returnMap.put(key, buf.array()); } return Collections.unmodifiableMap(returnMap); }
From source file:cn.homecredit.web.listener.MyOsgiHost.java
@Override public Map<String, Bundle> getBundles() { Map<String, Bundle> bundles = new HashMap<String, Bundle>(); for (Bundle bundle : felix.getBundleContext().getBundles()) { bundles.put(bundle.getSymbolicName(), bundle); }/* w w w. j a v a2 s . c o m*/ return Collections.unmodifiableMap(bundles); }
From source file:main.export.sql.DataImporter.java
private void initEntity(DataConfig.Entity e, Map<String, DataConfig.Field> fields, boolean docRootFound) { e.allAttributes.put(DATA_SRC, e.dataSource); if (!docRootFound && !"false".equals(e.docRoot)) { e.isDocRoot = true;/*from ww w . j av a 2 s .c om*/ } if (e.fields != null) { for (DataConfig.Field f : e.fields) { fields.put(f.getName(), f); f.entity = e; f.allAttributes.put("boost", f.boost.toString()); f.allAttributes.put("toWrite", Boolean.toString(f.toWrite)); e.allFieldsList.add(Collections.unmodifiableMap(f.allAttributes)); } } e.allFieldsList = Collections.unmodifiableList(e.allFieldsList); e.allAttributes = Collections.unmodifiableMap(e.allAttributes); if (e.entities == null) return; for (DataConfig.Entity e1 : e.entities) { e1.parentEntity = e; initEntity(e1, fields, e.isDocRoot || docRootFound); } }
From source file:com.ciphertool.sentencebuilder.dao.BasicWordMapDao.java
@Override public Map<Integer, ArrayList<Word>> getLengthWordMap() { return Collections.unmodifiableMap(lengthWordMap); }
From source file:com.yahoo.parsec.clients.ParsecAsyncHttpRequest.java
/** * Get form parameters.//from w w w. java2 s . com * * @return Form parameters */ public Map<String, List<String>> getFormParams() { return Collections.unmodifiableMap(formParams); }
From source file:brooklyn.util.http.HttpToolResponse.java
public Map<String, List<String>> getHeaderLists() { synchronized (mutex) { if (headerLists == null) { Map<String, List<String>> headerListsMutable = Maps.newLinkedHashMap(); for (Header header : response.getAllHeaders()) { List<String> vals = headerListsMutable.get(header.getName()); if (vals == null) { vals = new ArrayList<String>(); headerListsMutable.put(header.getName(), vals); }/*from w ww . j a va2 s .c om*/ vals.add(header.getValue()); } headerLists = Collections.unmodifiableMap(headerListsMutable); } } return headerLists; }
From source file:it.matjaz.jnumerus.RomanCharMapFactory.java
/** * Constructs an unmodifiable HashMap with 13 entries <roman character, * its integer value>./*from w ww . j a v a2 s . c o m*/ * <p> * The Map's keys are roman characters stored as Strings and they point to * their integer values. Those entries are used for conversions of whole * Strings of roman numerals. The Map is * {@link Collections#unmodifiableMap(java.util.Map) unmodifiable}. * <p> * The map returned by this method is the exact opposite of the one returned * by {@link #generateInverseCharMap() } (keys and values are switched). The * Map is filled by inserting values from the * {@link #generateCharPairsArray() }. * <p> * The followind table offers a representation of the content of the * generated structure: * * <pre> * key val * rom int * ------- * M 1000 * CM 900 * D 500 * CD 400 * C 100 * XC 90 * L 50 * XL 40 * X 10 * IX 9 * V 5 * IV 4 * I 1 * </pre> * * @return HashMap<String, Integer> containing roman characters as * keys and the respective integer values. */ public static Map<String, Integer> generateCharMap() { Map<String, Integer> charMap = new HashMap(); for (Pair charAndValue : generateCharPairsArray()) { charMap.put((String) charAndValue.getKey(), (Integer) charAndValue.getValue()); } return Collections.unmodifiableMap(charMap); }
From source file:com.ifunshow.antelopeframe.core.web.exception.SimpleMappingExceptionResolver.java
/** * Returns the HTTP status codes provided via {@link #setStatusCodes(Properties)}. * Keys are view names; values are status codes. *///from w w w . ja v a 2 s . com public Map<String, Integer> getStatusCodesAsMap() { return Collections.unmodifiableMap(statusCodes); }
From source file:com.infinities.keystone4j.token.provider.api.TokenProviderApiImpl.java
public TokenProviderApiImpl(AssignmentApi assignmentApi, CatalogApi catalogApi, IdentityApi identityApi, TrustApi trustApi, RevokeApi revokeApi, TokenProviderDriver tokenProviderDriver, PersistenceManager persistenceManager) throws Exception { super();//from ww w .ja v a 2 s. c o m this.persistenceManager = persistenceManager; persistenceManager.setTokenProviderApi(this); this.revokeApi = revokeApi; this.trustApi = trustApi; this.assignmentApi = assignmentApi; PKI_PROVIDER = new PkiProvider(identityApi, assignmentApi, catalogApi, trustApi); PKIZ_PROVIDER = new PkizProvider(identityApi, assignmentApi, catalogApi, trustApi); UUID_PROVIDER = new UuidProvider(identityApi, assignmentApi, catalogApi, trustApi); Map<String, BaseProvider> m = new HashMap<String, BaseProvider>(); m.put("PKI", PKI_PROVIDER); m.put("PKIZ", PKIZ_PROVIDER); m.put("UUID", UUID_PROVIDER); FORMAT_TO_PROVIDER = Collections.unmodifiableMap(m); this.driver = getTokenProvider(); registerCallbackListeners(); }