Example usage for java.util Collections unmodifiableMap

List of usage examples for java.util Collections unmodifiableMap

Introduction

In this page you can find the example usage for java.util Collections unmodifiableMap.

Prototype

public static <K, V> Map<K, V> unmodifiableMap(Map<? extends K, ? extends V> m) 

Source Link

Document

Returns an unmodifiable view of the specified map.

Usage

From source file:mousio.etcd4j.responses.EtcdLeaderStatsResponse.java

public EtcdLeaderStatsResponse(@JsonProperty("leader") String leader,
        @JsonProperty("followers") Map<String, EtcdLeaderStatsResponse.FollowerInfo> followers) {
    this.leader = leader;
    this.followers = Collections.unmodifiableMap(followers);
}

From source file:de.msquadrat.blobwizard.ServerConfiguration.java

public Map<String, Store> getStores() {
    if (stores == null) {
        return Collections.emptyMap();
    }/*www  .  j a va  2  s.  c o  m*/
    return Collections.unmodifiableMap(stores);
}

From source file:org.os890.ds.addon.spring.impl.CdiSpringScope.java

public CdiSpringScope(BeanManager beanManager, Map<String, Bean<?>> cdiBeansForSpringRegistration) {
    this.fallbackBeanManager = beanManager;
    this.cdiBeansForSpringRegistration = Collections.unmodifiableMap(cdiBeansForSpringRegistration);
}

From source file:com.smartling.api.sdk.exceptions.SmartlingApiException.java

public SmartlingApiException(String message, Throwable cause, List<Error> originalErrors) {
    super(message, cause);
    this.originalErrors = originalErrors;
    this.requestId = HttpUtils.getRequestId().get() == null ? "N/A" : HttpUtils.getRequestId().get();

    HttpUtils.ResponseDetails responseDetails = HttpUtils.getResponseDetails().get();
    if (responseDetails != null) {
        this.statusCode = responseDetails.getStatusCode();
        this.responseHeaders = Collections.unmodifiableMap(convertHeadersToMap(responseDetails));
    } else {/*www . jav a  2  s. c  o m*/
        this.statusCode = 0;
        this.responseHeaders = Collections.emptyMap();
    }
}

From source file:azkaban.project.FlowTriggerDependency.java

/**
 * @throws IllegalArgumentException if name or type is null or blank
 * @throws IllegalArgumentException if depProps is null
 *//*  www.ja  v a 2  s.  c o m*/
public FlowTriggerDependency(final String name, final String type, final Map<String, String> depProps) {
    Preconditions.checkArgument(StringUtils.isNotBlank(name));
    Preconditions.checkArgument(StringUtils.isNotBlank(type));
    Preconditions.checkArgument(depProps != null);
    this.name = name;
    this.type = type;
    this.props = Collections.unmodifiableMap(depProps);
    //todo chengren311: validate per dependencyType: some dependency type might need extra special
    //check, also check if it's a valid dependency type
}

From source file:com.openshift.internal.restclient.model.template.Template.java

@Override
public Map<String, String> getObjectLabels() {
    return Collections.unmodifiableMap(asMap(TEMPLATE_OBJECT_LABELS));
}

From source file:io.cloudslang.orchestrator.entities.BranchContexts.java

public Map<String, Serializable> getSystemContext() {
    return Collections.unmodifiableMap(systemContext);
}

From source file:com.github.aistomin.jenkins.real.UsernamePasswordCredentials.java

@Override
public Map<String, String> headers() throws Exception {
    final Map<String, String> map = new ConcurrentHashMap<>();
    map.put("Authorization", String.format("Basic %s",
            Base64.encodeBase64String(String.format("%s:%s", this.user, this.pass).getBytes("UTF-8"))));
    return Collections.unmodifiableMap(map);
}

From source file:io.github.carlomicieli.footballdb.starter.parsers.PlayerCareerParser.java

private static Map<String, String> extractValues(Element el) {
    Map<String, String> values = new HashMap<>();
    values.put("SeasonStats", el.child(0).text());
    values.put("Team", el.child(1).text());
    values.put("G", el.child(2).text());
    values.put("GS", el.child(3).text());
    return Collections.unmodifiableMap(values);
}

From source file:edu.cornell.mannlib.vitro.webapp.config.ConfigurationPropertiesImpl.java

public ConfigurationPropertiesImpl(InputStream stream, Map<String, String> preemptiveProperties,
        Map<String, String> buildProperties) throws IOException {
    Map<String, String> map = new HashMap<>(buildProperties);

    Properties props = loadFromPropertiesFile(stream);
    for (String key : props.stringPropertyNames()) {
        map.put(key, props.getProperty(key));
    }/*ww w.  j  a  va 2 s .  c o m*/

    if (preemptiveProperties != null) {
        map.putAll(preemptiveProperties);
    }

    trimWhiteSpaceFromValues(map);

    this.propertyMap = Collections.unmodifiableMap(map);
    log.debug("Configuration properties are: " + map);
}