Package cn.webwheel

Examples of cn.webwheel.SetterInfo


    private BeanSetter(Class<?> type, String paramName, ActionSetter actionSetter) {
        this.type = type;
        Field[] fields = type.getFields();
        for (int i = fields.length - 1; i >= 0; i--) {
            Field field = fields[i];
            SetterInfo si = actionSetter.getSetterInfo(field, paramName + '.' + field.getName());
            if (si != null) {
                setters.add(si);
            }
        }
        Method[] methods = type.getMethods();
        for (int i = methods.length - 1; i >= 0; i--) {
            Method m = methods[i];
            String name = ActionSetter.isSetter(m);
            if (name == null) continue;
            name = paramName + '.' + name;
            SetterInfo si = actionSetter.getSetterInfo(m, name);
            if (si != null) {
                setters.add(si);
            }
        }
        for (int i = methods.length - 1; i >= 0; i--) {
            Method m = methods[i];
            String name = ActionSetter.isGetter(m);
            if (name == null) continue;
            name = paramName + '.' + name;
            BeanSetter beanSetter = BeanSetter.create(m.getReturnType(), name, actionSetter);
            if (beanSetter == null) {
                continue;
            }
            boolean find = false;
            for (SetterInfo si : setters) {
                if (!si.paramName.equals(name)) continue;
                if (!(si.setter instanceof BeanSetter)) continue;
                if (!(si.member instanceof Method)) continue;
                if (((Method) si.member).getParameterTypes().length != 1) continue;
                if (((Method) si.member).getParameterTypes()[0] != m.getReturnType()) continue;
                find = true;
                BeanSetter bs = (BeanSetter) si.setter;
                bs.setGetter(m);
                break;
            }
            if (find) {
                continue;
            }
            SetterInfo si = new SetterInfo();
            si.paramName = name;
            si.member = m;
            si.setter = beanSetter;
            beanSetter.setGetter(m);
            setters.add(si);
View Full Code Here

TOP

Related Classes of cn.webwheel.SetterInfo

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.