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:net.jcreate.e3.table.model.MapDataModel.java

public MapDataModel(Map pDatas) {
    if (pDatas == null) {
        this.datas = Collections.EMPTY_MAP;
    } else {// www .j  av a2  s.c om
        this.datas = pDatas;
    }
    this.datasIterator = datas.entrySet().iterator();
}

From source file:com.espertech.esper.epl.core.eval.EvalInsertNoWildcardSingleColCoercionBeanWrap.java

public EventBean processFirstCol(Object result) {
    EventBean wrappedEvent = super.getEventAdapterService().adapterForBean(result);
    return super.getEventAdapterService().adapterForTypedWrapper(wrappedEvent, Collections.EMPTY_MAP,
            super.getResultEventType());
}

From source file:architecture.ee.web.util.ParamUtils.java

public static <T> T getJsonParameter(HttpServletRequest request, String name, Class<T> requiredType) {
    try {/* w w  w  .  j ava2  s  .  c o  m*/
        String jsonString = getParameter(request, name);
        com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper();
        return (T) mapper.readValue(jsonString, requiredType);
    } catch (Exception e) {

        log.error(e);

        if (requiredType == List.class)
            return (T) Collections.EMPTY_LIST;
        else if (requiredType == Map.class) {
            return (T) Collections.EMPTY_MAP;
        }
        return null;
    }
}

From source file:org.geotools.data.h2.H2DataStoreFactoryTest.java

public void testCanProcess() throws Exception {
    assertFalse(factory.canProcess(Collections.EMPTY_MAP));
    assertTrue(factory.canProcess(params));
}

From source file:com.espertech.esper.epl.core.eval.EvalInsertNoWildcardSingleColCoercionMap.java

public EventBean processFirstCol(Object result) {
    EventBean wrappedEvent = super.getEventAdapterService().adaptorForTypedMap((Map) result,
            super.getResultEventType());
    return super.getEventAdapterService().adaptorForTypedWrapper(wrappedEvent, Collections.EMPTY_MAP,
            super.getResultEventType());
}

From source file:org.lendingclub.mercator.bind.model.ResourceRecordSet.java

public ResourceRecordSet(String name, Integer ttl, String type, String classType, T records) {
    this.name = name;
    this.type = Preconditions.checkNotNull(type, "type of %s", name);

    if (ttl != null) {
        boolean rfc2181 = ttl >= 0 && ttl.longValue() <= 0x7FFFFFFFL;
        Preconditions.checkArgument(rfc2181, "Invalid ttl value: %s, must be 0-2147483647", ttl);
    }/*from  ww  w .  j a  v  a  2 s. c  o  m*/
    this.ttl = ttl;
    this.classType = classType;
    this.recordData = records != null ? records : (T) Collections.EMPTY_MAP;
}

From source file:com.pscnlab.member.services.impl.RoleServiceImpl.java

@Override
public Map<Integer, Role> findMapByRoleIds(Set<Integer> roleIdsSet) {
    List<Role> roles = roleDao.findListByRoleIds(roleIdsSet);
    if (CollectionUtils.isEmpty(roles)) {
        return Collections.EMPTY_MAP;
    }/*from www . ja  v a 2 s.c o  m*/
    return roles.stream().collect(Collectors.toMap(Role::getUuidRole, Function.identity()));
}

From source file:com.espertech.esper.epl.core.eval.EvalInsertNoWildcardSingleColCoercionMapWrap.java

public EventBean processFirstCol(Object result) {
    EventBean wrappedEvent = super.getEventAdapterService().adapterForTypedMap((Map) result,
            super.getResultEventType());
    return super.getEventAdapterService().adapterForTypedWrapper(wrappedEvent, Collections.EMPTY_MAP,
            super.getResultEventType());
}

From source file:com.espertech.esper.epl.core.eval.EvalInsertNoWildcardSingleColCoercionObjectArrayWrap.java

public EventBean processFirstCol(Object result) {
    EventBean wrappedEvent = super.getEventAdapterService().adapterForTypedObjectArray((Object[]) result,
            super.getResultEventType());
    return super.getEventAdapterService().adapterForTypedWrapper(wrappedEvent, Collections.EMPTY_MAP,
            super.getResultEventType());
}

From source file:org.intermine.web.logic.aspects.AspectBinding.java

/**
 * Read in data set configuration from XML. The keys (set names) in the returned map
 * are ordered to match the ordering in the XML file.
 *
 * @param reader data set xml reader//from   ww  w  .  j  ava  2 s  .com
 * @return Map from set name to Aspect object
 * @throws SAXException if there is a problem parsing XML
 * @throws IOException if there is a IO problem
 */
public static Map<String, Aspect> unmarshal(Reader reader) throws IOException, SAXException {
    Digester digester = new Digester();
    digester.addObjectCreate("aspects", "java.util.ArrayList");
    digester.addObjectCreate("aspects/aspect", "org.intermine.web.logic.aspects.Aspect");
    digester.addSetProperties("aspects/aspect");
    digester.addCallMethod("aspects/aspect/subtitle", "setSubTitle", 0);
    digester.addCallMethod("aspects/aspect/icon-image", "setIconImage", 0);
    digester.addCallMethod("aspects/aspect/large-image", "setLargeImage", 0);
    digester.addCallMethod("aspects/aspect/tile-name", "setTileName", 0);
    digester.addCallMethod("aspects/aspect/intro-text", "setIntroText", 0);
    digester.addCallMethod("aspects/aspect/starting-points", "setStartingPoints", 0);
    digester.addObjectCreate("aspects/aspect/aspect-source", "org.intermine.web.logic.aspects.AspectSource");
    digester.addSetProperties("aspects/aspect/aspect-source");
    digester.addSetNext("aspects/aspect/aspect-source", "addAspectSource",
            "org.intermine.web.logic.aspects.AspectSource");
    digester.addSetNext("aspects/aspect", "add", "java.lang.Object");

    List list = (List) digester.parse(reader);
    if (list == null) {
        LOG.error("Failed to unmashal aspects (digester returned null)");
        return Collections.EMPTY_MAP;
    }
    Map<String, Aspect> map = new LinkedHashMap<String, Aspect>();
    Iterator iter = list.iterator();
    while (iter.hasNext()) {
        Aspect set = (Aspect) iter.next();
        map.put(set.getName(), set);
    }
    return map;

}