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:dk.netarkivet.common.utils.archive.HeritrixArchiveHeaderWrapper.java
@Override public Map<String, Object> getHeaderFields() { return Collections.unmodifiableMap(headerFields); }
From source file:com.ciphertool.zodiacengine.entities.cipherkey.CipherKeyChromosome.java
@Override public Map<String, Gene> getGenes() { return Collections.unmodifiableMap(genes); }
From source file:de.bitzeche.logging.gelfamqp4j.GelfAMQP4jAppender.java
@Override public Map<String, String> getFields() { if (fields == null) { fields = new HashMap<String, String>(); }/*from w ww. j a v a 2s. c o m*/ return Collections.unmodifiableMap(fields); }
From source file:com.thruzero.common.core.config.JFigConfig.java
@Override public Map<String, String> getSection(final String sectionName) { Map<String, String> result = null; @SuppressWarnings("unchecked") Map<String, String> section = jFig.getSection(sectionName); if (StringUtils.isEmpty(sectionName)) { throw new RuntimeException(ExceptionUtilsExt.decorateMessageLevel1( "The requested Config Section name is empty. Section name is: " + sectionName)); }//from ww w .j a v a 2s . c om if (section != null) { result = Collections.unmodifiableMap(section); } return result; }
From source file:com.stratelia.silverpeas.peasCore.servlets.WebComponentRequestContext.java
public Map<String, String> getPathVariables() { return Collections.unmodifiableMap(pathVariables); }
From source file:org.usrz.libs.httpd.handlers.RestHandlerProvider.java
@Override protected HttpHandler get(Injector injector, Configurations configurations) { /* Setup our object mapper (could be qualified with path) */ final ObjectMapper mapper = getInstance(injector, ObjectMapper.class, path); final Map<Class<?>, Integer> contractPriorities = new HashMap<>(); contractPriorities.put(MessageBodyWriter.class, Integer.MIN_VALUE); contractPriorities.put(MessageBodyReader.class, Integer.MIN_VALUE); config.register(/*from w ww . ja v a2s . c om*/ new JacksonJsonProvider(mapper, new Annotations[] { Annotations.JACKSON, Annotations.JAXB }), Collections.unmodifiableMap(contractPriorities)); /* Create a ServiceLocator parent of all locators and inject the configurations */ final ServiceLocator locator = ServiceLocatorFactory.create(injector, path); /* Set up the ObjectMapper that will be used by this application */ ServiceLocatorUtilities.addOneConstant(locator, mapper, null, ObjectMapper.class); /* Create a brand new Grizzly HTTP container from Jersey */ log.debug("Jersey application at \"%s\" initializing", path.value()); GrizzlyHttpContainer container = GrizzlyHttpContainerFactory.create(config, locator); log.info("Jersey application at \"%s\" initialized successfully", path.value()); /* Create our handler and add it to our server configuration */ final HttpServer server = injector.getInstance(HttpServer.class); server.getServerConfiguration().addHttpHandler(container, path.value()); log.info("Serving \"%s\" using Jersey application \"%s\"", path.value(), config.getApplicationName()); /* All done! */ return container; }
From source file:Main.java
/** * Copies the given {@link Map} into a new {@link Map}.<br> * // www .j a v a 2s .co m * @param <A> * the type of the keys of the map * @param <B> * the type of the values of the map * @param data * the given map * @return If the given map was empty, a {@link Collections#emptyMap()} is * returned<br> * If the given map contained only one entry, a * {@link Collections#singletonMap(Object, Object)}, containing * said entry, is returned <br> * If the given map contained more than one element, a * {@link Collections#unmodifiableMap(Map)}, containing the entries * of the given map, is returned. */ public static <A, B> Map<A, B> copy(Map<A, B> data) { final int size = data.size(); switch (size) { case 0: return Collections.emptyMap(); case 1: final A key = data.keySet().iterator().next(); return Collections.singletonMap(key, data.get(key)); default: return Collections.unmodifiableMap(new HashMap<A, B>(data)); } }
From source file:com.bluexml.side.framework.alfresco.commons.configurations.AbstractConfigurationFile.java
public Map<K, V> getDictionary() { if (dictionary == null) { dictionary = new HashMap<K, V>(); try {/*from ww w . j ava 2 s . c o m*/ for (Resource r : getResources()) { logger.info("Loading resource " + r.getDescription()); loadResource(r); } } catch (Exception e) { logger.error("error when traying to reload configuration", e); } } return Collections.unmodifiableMap(dictionary); }
From source file:de.fraunhofer.iosb.ilt.sta.service.Service.java
private Map<String, String> createCapability(String name, URL url) { Map<String, String> val = new HashMap<>(); val.put("name", name); val.put("url", url.toString()); return Collections.unmodifiableMap(val); }
From source file:net.bcsw.sdnwlan.config.SDNWLANConfig.java
/** * Get the access point configuration map * * @return map of access points with the sdnWLAN Access Point MAC address as the key * @throws ConfigException/*w w w .j av a2 s. c om*/ */ public Map<MacAddress, AccessPointConfig> getAccessPoints() { Map<MacAddress, AccessPointConfig> accessPoints = Maps.newHashMap(); if (object.has(ACCESS_POINT_INFO)) { ArrayNode nodeArray = (ArrayNode) object.path(ACCESS_POINT_INFO); nodeArray.forEach(accessNode -> { try { AccessPointConfig point = AccessPointConfig.valueOf(accessNode); if (accessPoints.put(point.getMacAddress(), point) != null) { throw new IllegalArgumentException("Duplicate access point entry"); } } catch (ConfigException e) { log.warn("AccessPoint Configuration Exception", e.toString()); } catch (IllegalArgumentException e) { log.warn("AccessPoint Illegal Argument Exception", e.toString()); } }); } return Collections.unmodifiableMap(accessPoints); }