Package com.alibaba.toolkit.util.resourcebundle

Examples of com.alibaba.toolkit.util.resourcebundle.ResourceBundleCreateException


        if (enumTypeName.length() > 0) {
            try {
                enumType = ContextClassLoader.loadClass(enumTypeName);
            } catch (ClassNotFoundException e) {
                throw new ResourceBundleCreateException(ResourceBundleConstant.RB_ENUM_CLASS_NOT_FOUND,
                                                        new Object[] {
                    enumTypeName,
                    ContextClassLoader.getClassLoader()
                }, e);
            }
View Full Code Here


        // ���ָ����enum����, ���Դ�enumֵ��Ϊresource key.
        if (enumType != null) {
            Enum enumObj = Enum.getEnumByName(enumType, (String) id);

            if (enumObj == null) {
                throw new ResourceBundleCreateException(ResourceBundleConstant.RB_ENUM_ID_NOT_FOUND,
                                                        new Object[] {
                    id,
                    enumType.getName()
                }, null);
            }

            id = enumObj.toString();
        }

        Object value = null;
        String type = resourceNode.getName();

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

        if (values.containsKey(id)) {
            throw new ResourceBundleCreateException(ResourceBundleConstant.RB_DUPLICATED_RESOURCE_KEY,
                                                    new Object[] {
                id
            }, null);
        }
View Full Code Here

                                      .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);
            }
View Full Code Here

            SAXReader reader = new SAXReader();
            Document  doc = reader.read(stream, systemId);

            return new XMLResourceBundle(doc);
        } catch (DocumentException e) {
            throw new ResourceBundleCreateException(ResourceBundleConstant.RB_FAILED_READING_XML_DOCUMENT,
                                                    new Object[] {
                systemId
            }, e);
        }
    }
View Full Code Here

        if (enumTypeName.length() > 0) {
            try {
                enumType = ContextClassLoader.loadClass(enumTypeName);
            } catch (ClassNotFoundException e) {
                throw new ResourceBundleCreateException(ResourceBundleConstant.RB_ENUM_CLASS_NOT_FOUND, new Object[] {
                        enumTypeName, ContextClassLoader.getClassLoader() }, e);
            }
        }

        for (Iterator i = groupNode.selectNodes(ResourceBundleConstant.XPATH_RESOURCES).iterator(); i.hasNext(); ) {
View Full Code Here

        // 如果指定了enum属性, 则以此enum值作为resource key.
        if (enumType != null) {
            Enum enumObj = Enum.getEnumByName(enumType, id);

            if (enumObj == null) {
                throw new ResourceBundleCreateException(ResourceBundleConstant.RB_ENUM_ID_NOT_FOUND, new Object[] { id,
                                                                                                                    enumType.getName() }, null);
            }

            id = enumObj.toString();
        }

        Object value = null;
        String type = resourceNode.getName();

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

        if (values.containsKey(id)) {
            throw new ResourceBundleCreateException(ResourceBundleConstant.RB_DUPLICATED_RESOURCE_KEY,
                                                    new Object[] { id }, null);
        }

        values.put(id, value);
    }
View Full Code Here

        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;
View Full Code Here

            SAXReader reader = new SAXReader();
            Document doc = reader.read(stream, systemId);

            return new XMLResourceBundle(doc);
        } catch (DocumentException e) {
            throw new ResourceBundleCreateException(ResourceBundleConstant.RB_FAILED_READING_XML_DOCUMENT,
                                                    new Object[] { systemId }, e);
        }
    }
View Full Code Here

        if (enumTypeName.length() > 0) {
            try {
                enumType = ContextClassLoader.loadClass(enumTypeName);
            } catch (ClassNotFoundException e) {
                throw new ResourceBundleCreateException(ResourceBundleConstant.RB_ENUM_CLASS_NOT_FOUND,
                                                        new Object[] {
                    enumTypeName,
                    ContextClassLoader.getClassLoader()
                }, e);
            }
View Full Code Here

        // ���ָ����enum����, ���Դ�enumֵ��Ϊresource key.
        if (enumType != null) {
            Enum enumObj = Enum.getEnumByName(enumType, (String) id);

            if (enumObj == null) {
                throw new ResourceBundleCreateException(ResourceBundleConstant.RB_ENUM_ID_NOT_FOUND,
                                                        new Object[] {
                    id,
                    enumType.getName()
                }, null);
            }

            id = enumObj.toString();
        }

        Object value = null;
        String type = resourceNode.getName();

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

        if (values.containsKey(id)) {
            throw new ResourceBundleCreateException(ResourceBundleConstant.RB_DUPLICATED_RESOURCE_KEY,
                                                    new Object[] {
                id
            }, null);
        }
View Full Code Here

TOP

Related Classes of com.alibaba.toolkit.util.resourcebundle.ResourceBundleCreateException

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.