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:PropertyUtils.java

/**
 * Get map with property descriptors for the specified bean class
 *///w  ww.  j  a  v  a2  s  .c o m
private static Map getPropertyDescriptors(Class clazz) {
    HashMap map = (HashMap) descriptorCache.get(clazz);
    if (map == null) {
        BeanInfo beanInfo = null;
        try {
            beanInfo = Introspector.getBeanInfo(clazz);
        } catch (IntrospectionException e) {
            return Collections.EMPTY_MAP;
        }
        PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
        if (descriptors == null)
            descriptors = new PropertyDescriptor[0];
        map = new HashMap(descriptors.length);
        for (int i = 0; i < descriptors.length; i++)
            map.put(descriptors[i].getName(), descriptors[i]);
        descriptorCache.put(clazz, map);
    }
    return map;
}

From source file:amfservices.navigate.Authenticate.java

public static Map<String, Object> authenticate(SessionCache sessions, Map<String, Object> params) {
    try {/*w  ww .  j a v a2s  . c om*/
        Map<String, Object> data = (Map) params.get("data");

        String uid = (String) data.get(PGMacro.UID);
        String sid = (String) data.get(PGMacro.SID);
        String signedReq = (String) data.get(PGMacro.SIGNED_REQUEST);

        SNServices zing = new SNServices(signedReq);
        PGException.Assert(uid.equals(zing.getUserInfo().getUid()), PGError.INVALID_USER,
                "Invalid signed request");

        sessions.putSession(sid, uid);
    } catch (IOException ex) {
        PGException.pgThrow(ex);
    } catch (ZingMeApiException ex) {
        PGException.pgThrow(ex);
    } finally {
        EntityPool.inst().releaseAllThreadResources();
        PGLog.info("authenticate release resources");
    }

    return Collections.EMPTY_MAP;
}

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

/**
 * ?ip??/*  www  .  j  a  v  a 2 s  . com*/
 *
 * @param ip
 * @param mobile
 * @return
 * {"reason_code":null,"final_decision":"Accept","seq_id":"1442309654522-72705995","final_score":0,"success":true}
 */
public static Map<String, Object> queryTradeEvent(String ip, String mobile) {
    if (StringUtils.isBlank(ip) && StringUtils.isBlank(mobile)) {
        return Collections.EMPTY_MAP;
    }
    Map<String, Object> params = new HashMap<>();
    params.put("account_mobile", mobile);
    params.put("ip_address", ip);
    return DataProxy.queryForMap(serviceName, operationName_trade, params);
}

From source file:edu.cornell.mannlib.vitro.webapp.filestorage.uploadrequest.SimpleHttpServletRequestWrapper.java

SimpleHttpServletRequestWrapper(HttpServletRequest request) {
    super(request);
    request.setAttribute(FILE_ITEM_MAP, Collections.EMPTY_MAP);
}

From source file:com.collective.celos.ci.testing.fixtures.compare.FixObjectCompareResult.java

public static FixObjectCompareResult failed(String message) {
    return new FixObjectCompareResult(Collections.EMPTY_MAP, message, Status.FAIL);
}

From source file:org.jhk.pulsing.web.service.prod.helper.PulseServiceUtil.java

public static Map<Long, String> processTrendingPulseSubscribe(Set<String> tps, ObjectMapper objMapper) {

    @SuppressWarnings("unchecked")
    Map<Long, String> tpSubscriptions = Collections.EMPTY_MAP;
    final Map<String, Integer> count = new HashMap<>();

    tps.parallelStream().forEach(tpsIdValueCounts -> {

        try {/*from  ww  w  .  j a  va  2  s.c  o m*/
            _LOGGER.debug(
                    "PulseServiceUtil.processTrendingPulseSubscribe: trying to convert " + tpsIdValueCounts);

            Map<String, Integer> converted = objMapper.readValue(tpsIdValueCounts,
                    _TRENDING_PULSE_SUBSCRIPTION_TYPE_REF);

            _LOGGER.debug("PulseServiceUtil.processTrendingPulseSubscribe: sucessfully converted "
                    + converted.size());

            //Structure is <id>0x07<value>0x13<timestamp> -> count; i.e. {"10020x07Mocked 10020x13<timestamp>" -> 1}
            //Need to split the String content, gather the count for the searched interval
            //and return the sorted using Java8 stream
            //TODO impl better

            Map<String, Integer> computed = converted.entrySet().stream().reduce(new HashMap<String, Integer>(),
                    (Map<String, Integer> mapped, Entry<String, Integer> entry) -> {
                        String[] split = entry.getKey()
                                .split(CommonConstants.TIME_INTERVAL_PERSIST_TIMESTAMP_DELIM);
                        Integer value = entry.getValue();

                        mapped.compute(split[0], (key, val) -> {
                            return val == null ? value : val + value;
                        });

                        return mapped;
                    }, (Map<String, Integer> result, Map<String, Integer> aggregated) -> {
                        result.putAll(aggregated);
                        return result;
                    });

            computed.entrySet().parallelStream().forEach(entry -> {
                Integer value = entry.getValue();

                count.compute(entry.getKey(), (key, val) -> {
                    return val == null ? value : val + value;
                });
            });

        } catch (Exception cException) {
            cException.printStackTrace();
        }
    });

    if (count.size() > 0) {
        tpSubscriptions = count.entrySet().stream()
                .sorted(Map.Entry.comparingByValue(Comparator.reverseOrder()))
                .collect(Collectors.toMap(
                        entry -> Long.parseLong(
                                entry.getKey().split(CommonConstants.TIME_INTERVAL_ID_VALUE_DELIM)[0]),
                        entry -> entry.getKey().split(CommonConstants.TIME_INTERVAL_ID_VALUE_DELIM)[1],
                        (x, y) -> {
                            throw new AssertionError();
                        }, LinkedHashMap::new));
    }

    return tpSubscriptions;
}

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

/**
 * Json ? Map  .//  www  .j av a2 s.c o m
 * @param request
 * @param name
 * @return
 */
public static Map getJsonParameter(HttpServletRequest request, String name) {
    try {
        String jsonString = getParameter(request, name);
        com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper();
        return mapper.readValue(jsonString, Map.class);
    } catch (Exception e) {
        return Collections.EMPTY_MAP;
    }
}

From source file:school.service.StudyBuddyServiceImpl.java

@Override
public Iterable<Map<String, Object>> getStudyBuddiesByPopularity() {
    String query = "MATCH (s:StudyBuddy)-[:BUDDY]->(p:Student) return p, count(s) as buddies ORDER BY buddies DESC";
    return Neo4jSessionFactory.getInstance().getNeo4jSession().query(query, Collections.EMPTY_MAP);
}

From source file:org.geoserver.wfs.notification.TriggerFileWatcher.java

public TriggerFileWatcher(long checkPeriod, URL u) {
    super(checkPeriod, Collections.EMPTY_MAP, u);
}

From source file:no.hal.scxml.javascript.JavascriptContext.java

public Map getVars() {
    return (vars == null ? Collections.EMPTY_MAP : vars);
}