public Object getValue()

in core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ExtValELResolver.java [98:167]


    public Object getValue(ELContext elContext, Object base, Object property)
    {
        Object result = this.wrapped.getValue(elContext, base, property);

        //very first call for an expression
        if(this.expression == null)
        {
            this.expression = (String)property;
        }
        //#{bean[dynBase.propertyName]} -> base of dynBase is null -> stop path recording
        else if(base == null)
        {
            this.isPathRecordingStopped = true;
        }
        else
        {
            boolean propertyExists = false;
            String propertyName = property.toString();
            propertyName = propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);

            try
            {
                if(base instanceof Map)
                {
                    if(((Map)base).containsKey(property))
                    {
                        propertyExists = true;
                    }
                }
                else if(ProxyUtils.getUnproxiedClass(base.getClass()).getMethod("get" + propertyName) != null)
                {
                    propertyExists = true;
                }
            }
            catch (NoSuchMethodException e)
            {
                try
                {
                    if(ProxyUtils.getUnproxiedClass(base.getClass()).getMethod("is" + propertyName) != null)
                    {
                        propertyExists = true;
                    }
                }
                catch (NoSuchMethodException e1)
                {
                    this.logger.finest("property: " + property +
                            " isn't used for path - it isn't a property of " + base.getClass());
                }
            }

            //e.g.: #{bean.subBase.property} -> here we are at subBase
            if(propertyExists && !this.isPathRecordingStopped)
            {
                this.expression += "." + property;
            }
            else if(propertyExists && result instanceof String)
            {
                this.isPathRecordingStopped = false;
            }
        }

        /*
        if(this.isPathRecordingStopped && result instanceof String)
        {
            this.expression += "." + property;
        }
        */

        return result;
    }