Example usage for org.apache.commons.collections4 MapUtils getObject

List of usage examples for org.apache.commons.collections4 MapUtils getObject

Introduction

In this page you can find the example usage for org.apache.commons.collections4 MapUtils getObject.

Prototype

public static <K, V> V getObject(final Map<? super K, V> map, final K key) 

Source Link

Document

Gets from a Map in a null-safe manner.

Usage

From source file:org.broadleafcommerce.core.search.service.solr.index.SolrIndexCachedOperation.java

/**
 * Retrieve the cache bound to the current thread.
 *
 * @return The cache for the current thread, or null if not set
 *///from w w w.ja  v  a 2s  .  c o  m
public static CatalogStructure getCache() {
    BroadleafRequestContext ctx = BroadleafRequestContext.getBroadleafRequestContext();
    Catalog currentCatalog = ctx == null ? null : ctx.getCurrentCatalog();
    if (currentCatalog != null) {
        return MapUtils.getObject(CACHE.get(), currentCatalog.getId());
    } else {
        return MapUtils.getObject(CACHE.get(), DEFAULT_CATALOG_CACHE_KEY);
    }
}