Package com.alibaba.tamper.core

Examples of com.alibaba.tamper.core.BeanMappingException


                    return new Character((char) Integer.parseInt(strValue));
                } catch (NumberFormatException e) {
                }
            }

            throw new BeanMappingException("Unsupported convert: [" + String.class + "," + Character.class.getName()
                                           + "]");
        }
View Full Code Here


                if (destClass == BigInteger.class) {
                    return new BigInteger(str);
                }
            }

            throw new BeanMappingException("Unsupported convert: [" + src + "," + destClass.getName() + "]");
        }
View Full Code Here

    private static ValueProcess initValueProcess(String name) {
        String className = (String) properties.get(VALUEPROCESS_PREFIX + name);
        try {
            Class clazz = Class.forName(className);
            if (ValueProcess.class.isAssignableFrom(clazz) == false) {
                throw new BeanMappingException(className + " is not assign From ValueProcess!");
            }

            return (ValueProcess) ReflectionHelper.newInstance(clazz);
        } catch (ClassNotFoundException e) {
            throw new BeanMappingException(e);
        }
    }
View Full Code Here

    public static class SqlDateToDateConvertor extends AbastactConvertor {

        @Override
        public Object convert(Object src, Class destClass) {
            if (Date.class != destClass) {
                throw new BeanMappingException("Unsupported convert: [" + src + "," + destClass.getName() + "]");
            }
            if (src instanceof java.sql.Date) {
                return new Date(((java.sql.Date) src).getTime());
            }
            if (src instanceof java.sql.Timestamp) {
                return new Date(((java.sql.Timestamp) src).getTime());
            }
            if (src instanceof java.sql.Time) {
                return new Date(((java.sql.Time) src).getTime());
            }
            throw new BeanMappingException("Unsupported convert: [" + src + "," + destClass.getName() + "]");
        }
View Full Code Here

                if (destClass.equals(java.sql.Timestamp.class)) {
                    return new java.sql.Timestamp(value);
                }
            }

            throw new BeanMappingException("Unsupported convert: [" + src + "," + destClass.getName() + "]");
        }
View Full Code Here

            if (destClass == LinkedHashMap.class) {
                return new LinkedHashMap();
            }

            throw new BeanMappingException("Unsupported Map: [" + destClass.getName() + "]");

        }
View Full Code Here

            Node aliasClassNode = nodeList.item(i);
            if ("functionClass".equals(aliasClassNode.getNodeName())) {
                Node nameNode = aliasClassNode.getAttributes().getNamedItem("name");
                Node clazzNode = aliasClassNode.getAttributes().getNamedItem("class");
                if (nameNode == null || clazzNode == null) {
                    throw new BeanMappingException("alias or class is null , please check!");
                }

                String name = nameNode.getNodeValue();
                Class clazz = ReflectionHelper.forName(clazzNode.getNodeValue());
                ScriptHelper.getInstance().registerFunctionClass(name, ReflectionHelper.newInstance(clazz));
View Full Code Here

            if (destClass == TreeSet.class) {
                return new TreeSet();
            }

            throw new BeanMappingException("Unsupported Collection: [" + destClass.getName() + "]");
        }
View Full Code Here

            Node aliasClassNode = nodeList.item(i);
            if ("classAlias".equals(aliasClassNode.getNodeName())) {
                Node aliasNode = aliasClassNode.getAttributes().getNamedItem("alias");
                Node clazzNode = aliasClassNode.getAttributes().getNamedItem("class");
                if (aliasNode == null || clazzNode == null) {
                    throw new BeanMappingException("alias or class is null , please check!");
                }

                String alias = aliasNode.getNodeValue();
                Class clazz = ReflectionHelper.forName(clazzNode.getNodeValue());
                ReflectionHelper.registerClassAlias(aliasNode.getNodeValue(), clazz);
View Full Code Here

                    }
                }
                return target;
            }

            throw new BeanMappingException("Unsupported convert: [" + src + "," + destClass.getName() + "]");
        }
View Full Code Here

TOP

Related Classes of com.alibaba.tamper.core.BeanMappingException

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.