Example usage for java.util Collections EMPTY_MAP

List of usage examples for java.util Collections EMPTY_MAP

Introduction

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

Prototype

Map EMPTY_MAP

To view the source code for java.util Collections EMPTY_MAP.

Click Source Link

Document

The empty map (immutable).

Usage

From source file:com.newatlanta.appengine.vfs.provider.GaeFileContent.java

@SuppressWarnings("unchecked")
public Map getAttributes() throws FileSystemException {
    return Collections.EMPTY_MAP;
}

From source file:org.apache.cayenne.remote.service.BaseRemoteService.java

public Map<String, String> getEventBridgeParameters() {
    return eventBridgeParameters != null ? Collections.unmodifiableMap(eventBridgeParameters)
            : Collections.EMPTY_MAP;
}

From source file:org.geotools.data.wfs.internal.v1_1.TinyOwsTest.java

private WFSDataStore getWFSDataStore(HTTPClient httpClient) throws IOException, ServiceException {
    URL capabilitiesUrl = new URL(
            "http://127.0.0.1:8888/cgi-bin/tinyows?service=WFS&version=1.1.0&REQUEST=GetCapabilities");

    WFSDataStore wfs = new WFSDataStore(
            new WFSClient(capabilitiesUrl, httpClient, WFSConfig.fromParams(Collections.EMPTY_MAP)));
    return wfs;//from  w  w  w.  j  av a2 s . c  o  m
}

From source file:org.apache.cocoon.forms.binding.ComposedJXPathBindingBase.java

/**
 * Gets a binding class by id.//from  w w  w . j a v  a 2  s  .  co  m
 * @param id Id of binding class to get.
 */
public Binding getClass(String id) {
    if (classes == null) {
        classes = new HashMap();
        if (this.subBindings != null) {
            for (int i = 0; i < this.subBindings.length; i++) {
                Binding binding = this.subBindings[i];
                if (binding instanceof ClassJXPathBinding) {
                    String bindingId = binding.getId();
                    if (bindingId != null)
                        classes.put(bindingId, binding);
                }
            }

            // Fee memory used by an empty map
            if (classes.size() == 0) {
                classes = Collections.EMPTY_MAP;
            }
        }
    }
    return super.getClass(id);
}

From source file:com.ctrip.infosec.rule.resource.DataProxy.java

/**
 * ??//  w  w  w.j  a  va 2  s.c  o  m
 *
 * @param serviceName
 * @param operationName
 * @param params
 * @return
 */
public static Map queryForMap(String serviceName, String operationName, Map<String, Object> params) {
    check();
    beforeInvoke("DataProxy.queryForMap");
    beforeInvoke("DataProxy." + serviceName + "." + operationName);
    try {
        String cacheKey = buildCacheKey(serviceName, operationName, params);
        Map newResult = (Map) ThreadLocalCache.get(cacheKey);
        if (newResult == null) {
            boolean _isAsync = Contexts.isAsync();
            DataProxyQueryCommand command = new DataProxyQueryCommand(serviceName, operationName, params,
                    _isAsync);
            newResult = command.execute();
            if (serviceName.equals("UserProfileService")) {
                newResult = parseProfileResult(newResult);
            }
            if (newResult != null && !newResult.isEmpty()) {
                ThreadLocalCache.set(cacheKey, newResult);
            }
        } else {
            logger.info("hit cache, key = " + cacheKey);
        }
        return newResult;
    } catch (Exception ex) {
        fault("DataProxy.queryForMap");
        fault("DataProxy." + serviceName + "." + operationName);
        logger.error(Contexts.getLogPrefix() + "DataProxy.", ex);
        TraceLogger.traceLog("DataProxy, EXCEPTION: "
                + (ex.getCause() == null ? ex.toString() : ex.getCause().toString()));
    } finally {
        afterInvoke("DataProxy.queryForMap");
        afterInvoke("DataProxy." + serviceName + "." + operationName);
    }
    return Collections.EMPTY_MAP;
}

From source file:com.redhat.rhn.frontend.dto.SystemCompareDto.java

private List<List<Item>> compareList(List<List> lists) {
    return compareList(lists, Collections.EMPTY_MAP);
}

From source file:gov.nih.nci.caarray.util.CaArrayUtils.java

/**
 * Returns an empty collection or map of the appropriate type for a given collection class. By default, returns an
 * empty list, but will return an empty set, empty sorted set, or empty map if the passed in type is a subclass of
 * Set, SortedSet, or Map respectively./*  w w  w.  jav a  2s .  co m*/
 * 
 * @param collectionType the class of whose type to return an empty collection or map
 * @return the empty collection or map
 */
public static Object emptyCollectionOrMapFor(Class<?> collectionType) {
    Object val = Collections.EMPTY_LIST;
    if (SortedSet.class.isAssignableFrom(collectionType)) {
        val = EMPTY_SORTED_SET;
    } else if (Set.class.isAssignableFrom(collectionType)) {
        val = Collections.EMPTY_SET;
    } else if (List.class.isAssignableFrom(collectionType)) {
        val = Collections.EMPTY_LIST;
    } else if (Map.class.isAssignableFrom(collectionType)) {
        val = Collections.EMPTY_MAP;
    }
    return val;
}

From source file:org.geoserver.security.rest.UserPasswordResource.java

@Override
public Map getMap() throws Exception {
    return Collections.EMPTY_MAP;
}

From source file:no.sesat.search.datamodel.DataModelFactoryImpl.java

@SuppressWarnings("unchecked")
public DataModel instantiate() {

    try {/*from w ww  . ja va2s  . c  om*/
        final Class<DataModel> cls = DataModel.class;

        final PropertyDescriptor[] propDescriptors = Introspector.getBeanInfo(DataModel.class)
                .getPropertyDescriptors();
        final Property[] properties = new Property[propDescriptors.length];
        for (int i = 0; i < properties.length; ++i) {
            properties[i] = new Property(propDescriptors[i].getName(),
                    propDescriptors[i] instanceof MappedPropertyDescriptor
                            ? new MapDataObjectSupport(Collections.EMPTY_MAP)
                            : null);
        }

        final InvocationHandler handler = new BeanDataModelInvocationHandler(
                new BeanDataModelInvocationHandler.PropertyInitialisor(DataModel.class, properties));

        return (DataModel) ConcurrentProxy.newProxyInstance(cls.getClassLoader(), new Class[] { cls }, handler);

    } catch (IntrospectionException ie) {
        throw new IllegalStateException("Need to introspect DataModel properties before instantiation");
    }
}

From source file:it.unibas.spicy.model.mapping.rewriting.egds.operators.GenerateSTTGDOverlapMapReuse.java

@SuppressWarnings("unchecked")
public STTGDOverlapMap generateOverlapMap(List<FORule> stTgds, MappingTask mappingTask) {
    if (!mappingTask.getConfig().rewriteOverlaps()) {
        if (logger.isDebugEnabled())
            logger.debug("------------- EGDs must not be rewritten. Returning... --------------------");
        return new STTGDOverlapMap(mappingTask, Collections.EMPTY_MAP);
    }//from w  w  w.  ja va 2s  .  com
    if (logger.isDebugEnabled())
        logger.debug("------------- GENERATING OVERLAP MAP --------------------");
    List<FORule> renamedTgds = renameTgds(stTgds);
    //        if (logger.isDebugEnabled()) logger.debug("Initial st tgds:\n" + SpicyEngineUtility.printTgdsInLogicalForm(renamedTgds, mappingTask));
    if (logger.isDebugEnabled())
        logger.debug("Initial st tgds:\n" + SpicyEngineUtility.printTgds(renamedTgds, mappingTask));
    STTGDOverlapMap overlapMap = new STTGDOverlapMap(mappingTask, initializeMap(renamedTgds));
    boolean fixpoint;
    int iterations = 0;
    do {
        fixpoint = true;
        List<FORule> allTgds = new ArrayList<FORule>(overlapMap.getOverlapMap().keySet());
        Collections.sort(allTgds);
        for (int i = 0; i < allTgds.size(); i++) {
            FORule tgdI = allTgds.get(i);
            for (int j = i; j < allTgds.size(); j++) {
                FORule tgdJ = allTgds.get(j);
                if (!existsMeaningfulOverlap(tgdI, tgdJ, i, j, overlapMap, mappingTask)) {
                    continue;
                }
                fixpoint = fixpoint && generateOverlapTgds(tgdI, tgdJ, overlapMap, mappingTask);
            }
        }
        iterations++;
    } while (!fixpoint && iterations <= maxIterations);
    if (fixpoint == false) {
        //            throw new IllegalMappingTaskException("Computation of overlap tgds did not reach fixpoint after fixed number of iterations (" + maxIterations + ")\n" + SpicyEngineUtility.printTgdsInLogicalForm(new ArrayList<TGD>(overlapMap.getOverlapMap().keySet()), mappingTask));
        logger.error("Computation of overlap tgds did not reach fixpoint after fixed number of iterations ("
                + maxIterations + ")\n" + SpicyEngineUtility.printTgdsInLogicalForm(
                        new ArrayList<FORule>(overlapMap.getOverlapMap().keySet()), mappingTask));
    }
    if (logger.isDebugEnabled())
        logger.debug("------------- FINAL OVERLAP MAP --------------------\n"
                + SpicyEngineUtility.printMap(overlapMap.getOverlapMap()));
    return overlapMap;
}