Code example for Method

Methods: getName, getParameterTypes, getReturnType

0
            getters.add(method);
        } 
 
        @SuppressWarnings("unchecked") 
        private static void introspectSet(Method method, Map<String, Map<String, Object>> propertyMap) {
            String methodName = method.getName();
             
            if (!method.getName().startsWith("set"))
            	return; 
             
            if (method.getParameterTypes().length != 1 || method.getReturnType() != void.class)
            	return; 
 
            String propertyName = decapitalize(methodName.substring(3));
 
            Map<String, Object> table = propertyMap.get(propertyName);
            if (table == null) {
                table = new HashMap<String, Object>();
                propertyMap.put(propertyName, table);
            } 
 
            List<Method> setters = (List<Method>)table.get("setters");
            if (setters == null) {
                setters = new ArrayList<Method>();
                table.put("setters", setters);
            } 
 
            // add new setter 
            setters.add(method);
        } 
 
        /** 
         * Checks and fixs all cases when several incompatible checkers / getters 
         * were specified for single property.