Package com.alibaba.tamper.core

Examples of com.alibaba.tamper.core.BeanMappingException


    public Object invoke(Object obj, Object value) throws BeanMappingException {
        try {
            field.set(obj, value);
            return value;
        } catch (Exception e) {
            throw new BeanMappingException("field invoke error!", e);
        }
    }
View Full Code Here


    @Override
    public Object invoke(Object obj) throws BeanMappingException {
        try {
            return (method == null ? null : method.invoke(obj, (Object[]) null));
        } catch (Exception e) {
            throw new BeanMappingException(e);
        }
    }
View Full Code Here

        Object[] pargs = { value };
        try {
            method.invoke(key, pargs);
            return value;
        } catch (Exception e) {
            throw new BeanMappingException(e);
        }
    }
View Full Code Here

        return (bulkBean != null);
    }

    protected BulkBean buildGetBulkBean(Introspector is, Class<?> clazz, String[] fields, Class[] args) {
        if (fields.length != args.length) {
            throw new BeanMappingException("fields and args size is not match!");
        }

        String[] getters = new String[fields.length];
        String[] setters = new String[fields.length];
        for (int i = 0; i < fields.length; i++) {
            String property = fields[i];
            Class arg = args[i];
            FastMethod setMethod = FastPropertySetExecutor.discover(is, clazz, property, arg);
            FastMethod getMethod = FastPropertyGetExecutor.discover(is, clazz, property);
            if (setMethod == null) {
                throw new BeanMappingException("class[" + clazz.getName() + "] field[" + property + "] arg["
                                               + arg.getName() + "] set Method is not exist!");
            }

            if (getMethod == null) {
                throw new BeanMappingException("class[" + clazz.getName() + "] field[" + property
                                               + "] get Method is not exist!");
            }

            if (getMethod.getReturnType() != arg) {
                throw new BeanMappingException("class[" + clazz.getName() + "] field[" + property
                                               + "] getMethod does not match declared type");
            }
            setters[i] = setMethod.getName();
            getters[i] = getMethod.getName();
        }
View Full Code Here

        Object[] pargs = { value };
        try {
            method.invoke(key, pargs);
            return value;
        } catch (Exception e) {
            throw new BeanMappingException(e);
        }
    }
View Full Code Here

    @Override
    public Object invoke(Object obj) throws BeanMappingException {
        if (flag) {
            return null;// 始终返回null值
        }
        throw new BeanMappingException("error flag");
    }
View Full Code Here

        FieldGetExecutor fExecutor = new FieldGetExecutor(getIntrospector(), clazz, property);
        if (fExecutor.isAlive()) {
            return fExecutor;
        }

        throw new BeanMappingException("can not found GetExecutor for Class[" + clazz.getName() + "] , identifier["
                                       + identifier + "]");
    }
View Full Code Here

        FieldSetExecutor fExecutor = new FieldSetExecutor(getIntrospector(), clazz, property, arg);
        if (fExecutor.isAlive()) {
            return fExecutor;
        }

        throw new BeanMappingException("can not found SetExecutor for Class[" + clazz.getName() + "] , identifier["
                                       + identifier + "]");
    }
View Full Code Here

     * 根据{@linkplain SetExecutor}获取对应的目标targetClass
     */
    private Class getTargetClass(Method setMethod) {
        Class[] params = setMethod.getParameterTypes();
        if (params == null || params.length != 1) {
            throw new BeanMappingException("illegal set method[" + setMethod.getName() + "] for ParameterType");
        }
        return params[0];
    }
View Full Code Here

    @Override
    public Object invoke(Object obj) throws BeanMappingException {
        if (flag) {
            return obj;
        }
        throw new BeanMappingException("error flag");
    }
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.