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:org.shredzone.commons.view.impl.ViewContextImpl.java

@Override
public void setPathParts(Map<String, String> pathParts) {
    this.pathParts = Collections.unmodifiableMap(pathParts);
}

From source file:com.joyent.triton.domain.Image.java

@Override
public Map<String, Object> asMap() {
    final Map<String, Object> attributes = new LinkedHashMap<>();

    if (getId() != null) {
        attributes.put("id", getId());
    }/*www .  j  a  v a  2  s  .  c  om*/

    if (getName() != null) {
        attributes.put("name", getName());
    }

    if (getVersion() != null) {
        attributes.put("version", getVersion());
    }

    if (getOs() != null) {
        attributes.put("os", getOs());
    }

    if (getRequirements() != null) {
        attributes.put("requirements", getRequirements());
    }

    if (getType() != null) {
        attributes.put("type", getType());
    }

    if (getDescription() != null) {
        attributes.put("description", getDescription());
    }

    if (getFiles() != null) {
        attributes.put("files", getFiles());
    }

    if (getTags() != null) {
        attributes.put("tags", getTags());
    }

    if (getHomepage() != null) {
        attributes.put("homepage", getHomepage());
    }

    if (getPublishedAt() != null) {
        attributes.put("published_at", getPublishedAt());
    }

    if (getOwner() != null) {
        attributes.put("owner", getOwner());
    }

    if (getState() != null) {
        attributes.put("state", getState());
    }

    attributes.put("public", isPubliclyAvailable());

    return Collections.unmodifiableMap(attributes);
}

From source file:com.haulmont.cuba.gui.data.impl.AbstractCollectionDatasource.java

@Override
public Map<String, Object> getLastRefreshParameters() {
    return savedParameters == null ? Collections.emptyMap() : Collections.unmodifiableMap(savedParameters);
}

From source file:de.skuzzle.polly.http.internal.HttpEventImpl.java

@Override
public Map<String, String> postGetMap() {
    synchronized (this) {
        if (this.postGet == null) {
            this.postGet = new HashMap<>(this.get.size() + this.post.size());

            this.postGet.putAll(this.get);
            join(this.postGet, this.post);
            this.postGet = Collections.unmodifiableMap(this.postGet);
        }//from w w w  .ja v a 2s  .c om
        return this.postGet;
    }
}

From source file:org.onehippo.forge.solr.indexer.task.SolrConfiguration.java

/**
 * Constructor//from   ww w .j  a va2 s  .c  om
 * @param session JCR session
 * @param solrFilterProperties Solr filter properties
 */
public SolrConfiguration(Session session, Map<String, String> solrFilterProperties) {
    Assert.notNull(session, "session must not be null");

    Collection<String> n = new HashSet<String>();
    Map<String, String> p = new HashMap<String, String>(solrFilterProperties);

    try {
        // Read configuration nodes
        NodeIterator ni = session.getWorkspace().getQueryManager().createQuery(QUERY, Query.SQL).execute()
                .getNodes();
        while (ni.hasNext()) {

            Node node = ni.nextNode();
            log.info("Loading Solr configuration from node {}", JcrUtils.getPath(node));

            // Read nodes to index from configuration
            if (node.hasProperty(Namespace.PROPERTY_NODE)) {
                for (Value value : node.getProperty(Namespace.PROPERTY_NODE).getValues()) {
                    String nodeName = StringUtils.trimToNull(value.getString());
                    if (nodeName != null) {
                        n.add(nodeName);
                    }
                }
            }

            // Read properties to index from configuration
            if (node.hasProperty(Namespace.PROPERTY_PROPERTY)) {
                for (Value value : node.getProperty(Namespace.PROPERTY_PROPERTY).getValues()) {
                    String propertyName = StringUtils.trimToNull(value.getString());
                    if (propertyName != null) {
                        p.put("dynamic_"
                                + WRONG_CHARACTER_PATTERN_FOR_SOLR_ID.matcher(propertyName).replaceAll("_"),
                                propertyName);
                    }
                }
            }
        }

    } catch (RepositoryException e) {
        log.error("An error occurred while loading the Solr configuration", e);
    }

    nodes = Collections.unmodifiableCollection(n);
    properties = Collections.unmodifiableMap(p);
    this.session = session;
}

From source file:com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.java

public void setDtdMappings(Map<String, String> mappings) {
    this.dtdMappings = Collections.unmodifiableMap(mappings);
}

From source file:ru.jts_dev.gameserver.parser.impl.PcParametersHolder.java

public Map<String, List<Double>> getCollisionBoxes() {
    return Collections.unmodifiableMap(collisionBoxes);
}

From source file:com.medallia.spider.api.DynamicInputImpl.java

public Map<String, UploadedFile> getFileUploads() {
    return Collections.unmodifiableMap(fileUploads);
}

From source file:net.sf.gazpachoquest.domain.core.Question.java

@Override
public Map<Language, QuestionTranslation> getTranslations() {
    return Collections.unmodifiableMap(translations);
}

From source file:com.link_intersystems.beans.BeanClass.java

/**
 *
 * @return a map whose keys are the property names of the properties that
 *         this class defines according to the java bean specification. The
 *         values are the corresponding {@link PropertyDescriptor}s. The
 *         returned Map is unmodifiable.
 * @since 1.2.0.0/*w ww.ja v  a  2  s.  c o m*/
 */
public Map<String, PropertyDescriptor> getPropertyDescriptors() {
    if (propertyDescriptors == null) {
        propertyDescriptors = Collections.unmodifiableMap(getPropertyDescriptors(null));
    }
    return propertyDescriptors;
}