Package com.alibaba.toolkit.util.collection

Examples of com.alibaba.toolkit.util.collection.ArrayHashMap$ValueIterator


     *
     * @throws ResourceBundleCreateException  ��������
     */
    protected Object getMapResource(String id, Node resourceNode)
            throws ResourceBundleCreateException {
        ListMap map = new ArrayHashMap();

        for (Iterator i = resourceNode.selectNodes(ResourceBundleConstant.XPATH_RESOURCES)
                                      .iterator(); i.hasNext();) {
            Node   mapItemNode = (Node) i.next();
            Object mapKey = mapItemNode.selectObject(ResourceBundleConstant.XPATH_RESOURCE_ID);

            if (map.containsKey(id)) {
                throw new ResourceBundleCreateException(ResourceBundleConstant.RB_DUPLICATED_MAP_RESOURCE_KEY,
                                                        new Object[] {
                    mapKey,
                    id
                }, null);
            }

            String mapItemType = mapItemNode.getName();
            Object value = null;

            if (ResourceBundleConstant.RB_RESOURCE_TYPE_MESSAGE.equals(mapItemType)) {
                value = getMessageResource(id, mapItemNode);
            } else if (ResourceBundleConstant.RB_RESOURCE_TYPE_MAP.equals(mapItemType)) {
                value = getMapResource(id, mapItemNode);
            } else if (ResourceBundleConstant.RB_RESOURCE_TYPE_LIST.equals(mapItemType)) {
                value = getListResource(id, mapItemNode);
            }

            map.put(mapKey, value);
        }

        return Collections.unmodifiableMap(map);
    }
View Full Code Here


     * @param resourceNode 代表resource信息的XML Node
     * @return resource的值
     * @throws ResourceBundleCreateException 解析错误
     */
    protected Object getMapResource(String id, Node resourceNode) throws ResourceBundleCreateException {
        ListMap map = new ArrayHashMap();

        for (Iterator i = resourceNode.selectNodes(ResourceBundleConstant.XPATH_RESOURCES).iterator(); i.hasNext(); ) {
            Node mapItemNode = (Node) i.next();
            Object mapKey = mapItemNode.selectObject(ResourceBundleConstant.XPATH_RESOURCE_ID);

            if (map.containsKey(id)) {
                throw new ResourceBundleCreateException(ResourceBundleConstant.RB_DUPLICATED_MAP_RESOURCE_KEY,
                                                        new Object[] { mapKey, id }, null);
            }

            String mapItemType = mapItemNode.getName();
            Object value = null;

            if (ResourceBundleConstant.RB_RESOURCE_TYPE_MESSAGE.equals(mapItemType)) {
                value = getMessageResource(id, mapItemNode);
            } else if (ResourceBundleConstant.RB_RESOURCE_TYPE_MAP.equals(mapItemType)) {
                value = getMapResource(id, mapItemNode);
            } else if (ResourceBundleConstant.RB_RESOURCE_TYPE_LIST.equals(mapItemType)) {
                value = getListResource(id, mapItemNode);
            }

            map.put(mapKey, value);
        }

        return Collections.unmodifiableMap(map);
    }
View Full Code Here

     *
     * @throws ResourceBundleCreateException  ��������
     */
    protected Object getMapResource(String id, Node resourceNode)
            throws ResourceBundleCreateException {
        ListMap map = new ArrayHashMap();

        for (Iterator i = resourceNode.selectNodes(ResourceBundleConstant.XPATH_RESOURCES)
                                      .iterator(); i.hasNext();) {
            Node   mapItemNode = (Node) i.next();
            Object mapKey = mapItemNode.selectObject(ResourceBundleConstant.XPATH_RESOURCE_ID);

            if (map.containsKey(id)) {
                throw new ResourceBundleCreateException(ResourceBundleConstant.RB_DUPLICATED_MAP_RESOURCE_KEY,
                                                        new Object[] {
                    mapKey,
                    id
                }, null);
            }

            String mapItemType = mapItemNode.getName();
            Object value = null;

            if (ResourceBundleConstant.RB_RESOURCE_TYPE_MESSAGE.equals(mapItemType)) {
                value = getMessageResource(id, mapItemNode);
            } else if (ResourceBundleConstant.RB_RESOURCE_TYPE_MAP.equals(mapItemType)) {
                value = getMapResource(id, mapItemNode);
            } else if (ResourceBundleConstant.RB_RESOURCE_TYPE_LIST.equals(mapItemType)) {
                value = getListResource(id, mapItemNode);
            }

            map.put(mapKey, value);
        }

        return Collections.unmodifiableMap(map);
    }
View Full Code Here

TOP

Related Classes of com.alibaba.toolkit.util.collection.ArrayHashMap$ValueIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.