public static Method findBeanMethod()

in src/main/java/org/apache/sling/scripting/sightly/compiler/util/ObjectModel.java [416:434]


    public static Method findBeanMethod(Class<?> cls, String baseName) {
        if (cls == null || StringUtils.isEmpty(baseName)) {
            return null;
        }
        Method[] publicMethods = cls.getMethods();
        String capitalized = StringUtils.capitalize(baseName);
        for (Method method : publicMethods) {
            if (method.getParameterTypes().length == 0) {
                String methodName = method.getName();
                if (baseName.equals(methodName) || ("get" + capitalized).equals(methodName) || ("is" + capitalized).equals(methodName)) {
                    if (isMethodAllowed(method)) {
                        return method;
                    }
                    break;
                }
            }
        }
        return null;
    }