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.liferay.mobile.android.http.Response.java
public Map<String, String> getHeaders() { Map<String, List<String>> headers = _response.headers().toMultimap(); Map<String, String> map = new HashMap<String, String>(); for (Map.Entry<String, List<String>> header : headers.entrySet()) { map.put(header.getKey(), header.getValue().get(0)); }/* ww w. ja va2 s . c o m*/ return Collections.unmodifiableMap(map); }
From source file:attila.core.MultipartRequest.java
@SuppressWarnings("unchecked") @Override//from www .j a v a 2s .co m public Map getParameterMap() { Map<String, String[]> map = new HashMap<String, String[]>(); for (String name : getTextParameters().keySet()) { map.put(name, (String[]) getTextParameters().get(name).toArray(new String[1])); } return Collections.unmodifiableMap(map); }
From source file:org.cloudfoundry.identity.uaa.authentication.AuthzAuthenticationRequest.java
public AuthzAuthenticationRequest(String username, String password, UaaAuthenticationDetails details) { Assert.hasText(username, "username cannot be empty"); Assert.hasText(password, "password cannot be empty"); HashMap<String, String> info = new HashMap<String, String>(); info.put("username", username.trim()); info.put("password", password.trim()); this.info = Collections.unmodifiableMap(info); this.details = details; }
From source file:com.bluexml.side.framework.alfresco.commons.configurations.RepositoryPropertiesConfiguration.java
public Map<String, String> getDictionary() { dictionary = new HashMap<String, String>(); try {/*from ww w. j av a 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); } logger.debug("getDictionary() " + dictionary); return Collections.unmodifiableMap(dictionary); }
From source file:net.sf.commons.ssh.directory.Directory.java
@SuppressWarnings("unchecked") Directory() {// w w w . j a va 2 s .c om Map<String, Description> descriptions; Map<String, String> oldClassNames; try { descriptions = Collections.unmodifiableMap(load()); } catch (Exception exc) { descriptions = Collections.EMPTY_MAP; log.error("Unable to load factories directory: " + exc.getMessage(), exc); } try { oldClassNames = Collections.unmodifiableMap(loadOldClassNames()); } catch (Exception e) { oldClassNames = Collections.EMPTY_MAP; log.error("Unable to load old class names of factories: " + e.getMessage(), e); } this.descriptions = descriptions; this.oldClassNames = oldClassNames; }
From source file:de.openknowledge.cdi.monitoring.HealthStatusQueryCommand.java
public Map<ComponentStatusType, Set<ComponentStatus>> getStatus() { return Collections.unmodifiableMap(status); }
From source file:me.bramhaag.discordselfbot.commands.admin.CommandEvaluate.java
@Command(name = "evaluate", aliases = { "eval", "e" }, minArgs = 1) public void execute(@NonNull Message message, @NonNull TextChannel channel, @NonNull String[] args) { String input = Util.combineArgs(Arrays.copyOfRange(args, 1, args.length)); Evaluate.Language language = Evaluate.Language.getLanguage(args[0]); if (language == null) { language = Evaluate.Language.JAVASCRIPT; input = Util.combineArgs(args); }/* w w w . j ava 2s .com*/ input = input.startsWith("```") && input.endsWith("```") ? input.substring(3, input.length() - 3) : input; Evaluate.Result result = language.evaluate(Collections.unmodifiableMap(Stream .of(ent("jda", message.getJDA()), ent("channel", message.getChannel()), ent("guild", message.getGuild()), ent("msg", message), ent("user", message.getAuthor()), ent("member", message.getGuild().getMember(message.getAuthor())), ent("bot", message.getJDA().getSelfUser())) .collect(Collectors.toMap(AbstractMap.SimpleEntry::getKey, AbstractMap.SimpleEntry::getValue))), input); message.editMessage(new EmbedBuilder() .setTitle("Evaluate " + StringUtils.capitalize(language.name().toLowerCase()), null) .addField("Input", new MessageBuilder().appendCodeBlock(input, language.name().toLowerCase()).build() .getRawContent(), true) .addField("Output", new MessageBuilder().appendCodeBlock(result.getOutput(), "javascript").build() .getRawContent(), true) .setFooter(result.getStopwatch().elapsed(TimeUnit.NANOSECONDS) == 0 ? Constants.CROSS_EMOTE + " An error occurred" : String.format(Constants.CHECK_EMOTE + " Took %d ms (%d ns) to complete | %s", result.getStopwatch().elapsed(TimeUnit.MILLISECONDS), result.getStopwatch().elapsed(TimeUnit.NANOSECONDS), Util.generateTimestamp()), null) .setColor(color).build()).queue(); }
From source file:net.e2.bw.servicereg.ldap.model.CachedServiceInstance.java
/** Constructor */ public CachedServiceInstance(String serviceInstanceId, String organizationId, String specificationId, String name, String summary, List<Area> coverage, List<ServiceEndpoint> endpoints, Map<String, List<String>> roleUserMap) { super.setServiceInstanceId(serviceInstanceId); super.setOrganizationId(organizationId); super.setSpecificationId(specificationId); super.setName(name); super.setSummary(summary); super.setCoverage(Collections.unmodifiableList(coverage != null ? coverage : new ArrayList<>())); super.setEndpoints(Collections.unmodifiableList(endpoints != null ? endpoints : new ArrayList<>())); this.roleUserMap = Collections.unmodifiableMap(roleUserMap != null ? roleUserMap : new HashMap<>()); // NB: Actually, each element of the roleUserMap should be made unmodifiable... }
From source file:net.e2.bw.servicereg.ldap.model.CachedOrganization.java
/** Constructor */ public CachedOrganization(String organizationId, String name, String summary, String url, String country, byte[] logo, List<String> memberIds, Map<String, List<String>> roleUserMap) { super.setOrganizationId(organizationId); super.setName(name); super.setSummary(summary); super.setUrl(url); super.setCountry(country); super.setLogo(logo); this.memberIds = Collections.unmodifiableList(memberIds != null ? memberIds : new ArrayList<>()); this.roleUserMap = Collections.unmodifiableMap(roleUserMap != null ? roleUserMap : new HashMap<>()); // NB: Actually, each element of the roleUserMap should be made unmodifiable... }
From source file:org.sbq.batch.mains.ActivityEmulator.java
private ActivityEmulator() { super();/* w w w. java2 s . c o m*/ blockingQueue = new LinkedBlockingQueue<Runnable>(); executor = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, blockingQueue); appCtx = new AnnotationConfigApplicationContext(ActivityEmulatorConfiguration.class); userService = appCtx.getBean(UserService.class); Map<String, AtomicBoolean> writableUserStatusByLogin = new HashMap<String, AtomicBoolean>(); for (User user : userService.findAllUsers()) { writableUserStatusByLogin.put(user.getLogin(), new AtomicBoolean(false)); } userStatusByLogin = Collections.unmodifiableMap(writableUserStatusByLogin); }