get a map of public setters (propertyName -> Method)

@param clazz
@return
547541
public static Map<String, Method> getSetters(Class<?> clazz) {
		Map<String, Method> setters = new HashMap<String, Method>();
		Method[] methods = clazz.getMethods();
		for (Method method : methods) {
			String methodName = method.getName();
			if (method.getParameterTypes().length == 1
					&& methodName.startsWith("set") && methodName.length() > 3
					&& method.getReturnType() == Void.TYPE) {
				String propertyName = methodName.substring(3, 4).toLowerCase();
				if (methodName.length() > 4) {
					propertyName += methodName.substring(4);
				}
				setters.put(propertyName, method);
			}
		}
		return setters;
	}
443086
@Override
  public final Method[] retrieveMethods(final Class<?> clazz) {
    Set<Method> fieldsSet = new HashSet<Method>();
    for (Method mfd : clazz.getDeclaredMethods()) {
      int modifiersMask = mfd.getModifiers();
      if ((modifiersMask & Modifier.PRIVATE) == 0
            && (modifiersMask & Modifier.STATIC) == 0) {
        fieldsSet.add(mfd);
      }
    }
    final Class<?> superClazz = clazz.getSuperclass();
    if (superClazz != null && superClazz != java.lang.Object.class) {
      for (Method mfd : retrieveMethods(superClazz)) {
        fieldsSet.add(mfd);
      }
    }
    return fieldsSet.toArray(new Method[fieldsSet.size()]);
  }
676788
protected void lookupSetters(final Map<String, Property> properties,
            final MethodHolder<?> clazz)
   {
      for (Method<?, ?> method : clazz.getMethods())
      {
         // Exclude static methods

         if (method.isStatic())
         {
            continue;
         }

         // Exclude non-public methods. Section 8.3.1 of the JavaBean specification requires that setters be public.
         if (!method.isPublic())
         {
            continue;
         }

         // Get type

         List<? extends Parameter<?>> parameters = method.getParameters();

         if (parameters.size() != 1)
         {
            continue;
         }

         // Get name

         String propertyName = isSetter(method);

         if (propertyName == null)
         {
            continue;
         }

         // Exclude based on other criteria
         //
         // (explicitly set to null in case we encountered an imbalanced field/getter)

         String type = parameters.get(0).getType().getQualifiedName();

         Field<?> privateField = getPrivateField((FieldHolder<?>) clazz, propertyName);

         if (privateField != null && this.privateFieldConvention == null)
         {
            propertyName = privateField.getName();
         }

         // Already found via its getter?

         Property existingProperty = properties.get(propertyName);

         if (existingProperty instanceof ForgeProperty)
         {
            ForgeProperty existingForgeProperty = (ForgeProperty) existingProperty;

            // Beware covariant return types: always prefer the getter's type

            properties.put(
                     propertyName,
                     new ForgeProperty(propertyName, existingForgeProperty.getType(),
                              existingForgeProperty.getReadMethod(), method, getPrivateField((FieldHolder<?>) clazz,
                                       propertyName), this.project));
            continue;
         }

         // Explicitly excluded based on getter already?

         if ((existingProperty == null) && properties.containsKey(propertyName))
         {
            continue;
         }

         properties
                  .put(propertyName,
                           new ForgeProperty(propertyName, type, null, method, privateField, this.project));
      }
   }
83333
private static Map<String, PropertyAccessor> _getAccessors(
                    final Class<?> clazz
                    )
    {
        Map<String, PropertyAccessor>  accessors = null;

        synchronized (_ACCESSORS_REG_) {
            accessors = _ACCESSORS_REG_.get( clazz );
            if (accessors == null) {
                accessors = PropertyAccessor.findAll( clazz );
                _ACCESSORS_REG_.put( clazz, accessors );
            }
        }

        return accessors;
    }
532695
@SuppressWarnings("unchecked")
    public static PropertyAccessor getPropertyAccessor(Class<?> clazz)
    {
        PropertyAccessor<?> accessor;
        if (clazz.isEnum())
        {
            accessor = new EnumAccessor();
        }
        else
        {
            accessor = map.get(clazz);
        }

        // allow fall-back to Object streamer.
        if (null == accessor)
        {
            if (Enum.class.isAssignableFrom(clazz))
            {
                accessor = map.get(Enum.class);
            }
            else
            {
                accessor = map.get(Object.class);
            }

        }
        return accessor;
    }
1082710
public static Map<String, Method> getMethodMap(Class<?> clazz, String prefix) {
        Method[] methods = clazz.getMethods();
        Map<String, Method> methodMap = new HashMap<>(32);
        for (Method method : methods) {
            if (Checker.isEmpty(prefix) || method.getName().startsWith(prefix)) {
                methodMap.put(method.getName(), method);
            }
        }
        return methodMap;
    }
341775
public static List<Method> getAccessors(Class<?> clazz) {
    if (clazz == null) {
      throw new IllegalArgumentException("The 'clazz' parameter cannot be null.");
    }

    List<Method> methods = new ArrayList<>();
    for (Method method : clazz.getMethods()) {
      String methodName = method.getName();
      if (!"getClass".equals(methodName) && !"hashCode".equals(methodName) && method.getReturnType() != null
          && !Void.class.equals(method.getReturnType()) && method.getParameterTypes().length == 0
          && ((methodName.startsWith("get") && methodName.length() > 3)
              || (methodName.startsWith("is") && methodName.length() > 2)
              || (methodName.startsWith("has") && methodName.length() > 3))) {
        methods.add(method);
      }
    }

    // Order the methods alphabetically by name
    sort(methods, new Comparator<Method>() {
      /**
       * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
       */
      @Override
      public int compare(Method method1, Method method2) {
        return method1.getName().compareTo(method2.getName());
      }
    });

    return unmodifiableList(methods);
  }
1197892
@SuppressWarnings("unchecked")
	@Override
	public <T> T getProperty(Object key, Class<T> clazz) {
	    return (T)getProperty(key);
	}
926849
@Override
    public <T> T getProperty(Object key, Class<T> clazz) {
        return clazz.cast(getProperty(key));
    }
840502
@SuppressWarnings("unchecked")
    public <T> List<T> getAnnotations(final Class<? extends Annotation> clazz) {
        return (List<T>) foundAnnotations.get(clazz);
    }
1173965
public static Method[] getDeclaredMethods(Class clazz) {
	Method[] methods = clazz.getMethods();
	ArrayList list = new ArrayList();
	for (int i = 0; i < methods.length; i++) {
	    if (methods[i].getDeclaringClass() == clazz) list.add(methods[i]);
	}
	if (list.size() == 0) return new Method[0];
	return (Method[]) list.toArray(new Method[list.size()]);
    }
9837
public static <T> Clazz<T> FindClazz( Class<T> clazz )
	{
		return impl.FindClazz( clazz );
	}
904175
public static Map<String, PropertyDescriptor> mapPropertyDescriptors(Class<?> clazz) {
        PropertyDescriptor[] properties = propertyDescriptors(clazz);
        Map<String, PropertyDescriptor> mappedProperties = new HashMap<String, PropertyDescriptor>();

        for (PropertyDescriptor property : properties) {
            if ("class".equals(property.getName()) == false) {
                mappedProperties.put(property.getName(), property);
            }
        }

        return mappedProperties;
    }
722932
private static Map<String, Method> getAllMethod(Class<?> clazz, Map<String, Method> methods) {
        if (clazz == null || clazz == Object.class) {
            return methods;
        }

        Arrays.stream(clazz.getDeclaredMethods()).forEach(method -> {
            String key = String.format("%s:%s", method.getName(),
                ByteCodeUtils.getMethodDesc(method));
            Method m = methods.get(key);
            if (m == null || (m.getDeclaringClass().isInterface()
                              && !method.getDeclaringClass().isInterface())) {
                methods.put(key, method);
            }
        });

        Arrays.stream(clazz.getInterfaces()).forEach(c -> getAllMethod(c, methods));

        return getAllMethod(clazz.getSuperclass(), methods);
    }
1105919
public <T> Mapping<T> getMapping(Class<T> clazz) {
        return (cache != null) ? cache.getMapping(clazz, annotationSet)
                : new Mapping<T>(clazz, annotationSet);
    }
101067
public static Method getterOrSetter(Class clazz, String fieldName, FieldAccessType methodType)
            throws IntrospectionException {

        if (null == fieldName || "".equals(fieldName))
            return null;

        BeanInfo beanInfo = Introspector.getBeanInfo(clazz);
        PropertyDescriptor[] props = beanInfo.getPropertyDescriptors();
        for (PropertyDescriptor prop : props) {
            if (fieldName.equals(prop.getName())) {
                if (FieldAccessType.SETTER == methodType) {
                    return prop.getWriteMethod();
                }
                if (FieldAccessType.GETTER == methodType) {
                    return prop.getReadMethod();
                }
            }
        }
        throw new IntrospectionException("Can not get the getter or setter method");
    }
136770
private static Method[] getAllPublicMethods(Class<?> clazz) {
        if (clazz == null) {
            throw new IllegalArgumentException("You must specify a class in order to get the methods.");
        }
        Set<Method> methods = new LinkedHashSet<Method>();

        for (Method method : clazz.getMethods()) {
            method.setAccessible(true);
            methods.add(method);
        }
        return methods.toArray(new Method[0]);
    }